Michael Millar
Michael Millar

Reputation: 1614

Generate orm.yml mapping file from existing entity file in Symfony

Is there a way to generate src\AppBundle\Resources\Config\doctrine\example.orm.yml file from an existing entity file src\AppBundle\Entity\Example.php, rather than use php bin/console doctrine:generate:entity to create a new entity?

Upvotes: 3

Views: 4584

Answers (1)

Maxime Thévenot
Maxime Thévenot

Reputation: 48

To Generate this file, you need something that doctrine can use to do it.

So if you have your database already up, you can do a

    php bin/console doctrine:mapping:import

but if you want to do it "code first", i guess you need to create the mapping information yourself and then use

    app/console generate:doctrine:entities <Your Bundle>
    app/console doctrine:schema:update --dump-sql
    app/console doctrine:schema:update --force

Upvotes: 1

Related Questions