dvillodres
dvillodres

Reputation: 11

Generate php entities from orm.xml Doctrine

Hi I'm on Symfony 5 and I'll like to generate php entities and update the scheme from a orm.xml file.

I think it worked before with doctrine:generate:entities command.

Any solution? Thanks in advance

Upvotes: 1

Views: 1225

Answers (1)

dbrumann
dbrumann

Reputation: 17166

The command doctrine:generate:entities was removed. The Doctrine ORM team does not encourage creating entities from existing schema and therefore deprecated that functionality in the ORM.

With the MakerBundle you can create entities, but as far as I know it won't create them from a schema, so you have to manually create each Entity, which admittedly can be annoying if you just want to generate them based on the existing schema anyway. Alternatively you can create a new "legacy" Symfony application (e.g. based on version 3.4 as this should still have the command), create the entities from the schema as described in the docs, and then copy the generated entities over into your project. You will likely also have to run a search & replace for AppBundle\Entity -> App\Entity.

Upvotes: 1

Related Questions