Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony: how verify doctrine entities mapping consistency

Navigating my app built with Symfony I discovered some mappings of some entities are inconsistent.

The Symfony Profiler tells me this:

AppBundle\Entity\Email The mappings AppBundle\Entity\Email#forCustomer and AppBundle\Entity\Customer#emails are inconsistent with each other.

and, in reverse:

AppBundle\Entity\Customer The association AppBundle\Entity\Customer#emails refers to the owning side field AppBundle\Entity\Email#owner which does not exist.

How can I check all entities in one time to discover this kind of inconsistency, without having to navigate all the app hoping I discover other inconsistencies?

like image 783
Aerendir Avatar asked Dec 15 '15 08:12

Aerendir


1 Answers

For Symfony version lower than 3.4 you can try with:

app/console doctrine:schema:validate

and for Symfony 3.4 and 4.*:

bin/console doctrine:schema:validate

like image 71
scoolnico Avatar answered Sep 17 '22 19:09

scoolnico