I have Entity classes generated with Doctrine ORM, and ZF2.
I changed a table structure and I want to update an entity class, so I am trying to regenerate the entity class but it's not working.
I used the following code:
vendor/doctrine/doctrine-module/bin/doctrine-module orm:convert-mapping --namespace="Album\Entity\" --force --from-database annotation ./module/Album/src/clear
I got the error:
[Doctrine\ORM\Mapping\MappingException]
Property "status" in "Album\Entity\TestRun" was already declared, but it must be declared only once
orm:convert-mapping [--filter="..."] [--force] [--from-database] [--extend[="..."]] [--num-spaces[="..."]] [--namespace[="..."]] to-type dest-path
I want to re-generate the entity class for a particular table
As mentioned above it might be a bad practice, but nevertheless I use the following commands to achieve the result you are asking about:
and another command to generate getters and setters:
If you change the structure of your Entity file a simple
\vendor\bin\doctrine-module orm:schema-tool:update --force
will alter the table according to your Entity definition.If you still want to recreate the table simple drop the table from your mysql and run the update command. You may have some cache files left so clearing those might be a good Idea, too.
You can clear the complete cache like so: