-1

I have an existing table with 5 columns, and I want to generate an Entity without that generates a new migration with new table!

Thanks!

Evgeny Ruban
  • 1,357
  • 1
  • 14
  • 20
Marc Garcia
  • 1,388
  • 1
  • 9
  • 21
  • 3
    The answer is in the [Symfony docs](https://symfony.com/doc/3.4/doctrine/reverse_engineering.html) – Evgeny Ruban Mar 12 '19 at 11:10
  • Possible duplicate of [Auto generate Doctrine-Entity from existing Table](https://stackoverflow.com/questions/34830718/auto-generate-doctrine-entity-from-existing-table) – Nico Haase Mar 12 '19 at 14:32

1 Answers1

-1

So, as I mentioned in comment - you just need to follow steps in Symfony documentation.

This way, for Symfony 3 you need follow this:

php bin/console doctrine:mapping:import --force AppBundle xml

This command line tool asks Doctrine to introspect the database and generate the XML metadata files under the src/AppBundle/Resources/config/doctrine folder of your bundle.

Once the metadata files are generated, you can ask Doctrine to build related entity classes by executing the following command.

php bin/console doctrine:mapping:convert annotation ./src

It will generate Entity classes, and after that you must to remove the XML files, generated by first command.

Evgeny Ruban
  • 1,357
  • 1
  • 14
  • 20
  • Might be worth adding a bit more detail in case someone stumbles across this answer in the future and link has gone dead. – Phil Cooper Mar 12 '19 at 16:38
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/22442750) – mustaccio Mar 12 '19 at 16:46
  • @mustaccio, thanks for your notes. Updated the answer. – Evgeny Ruban Mar 12 '19 at 18:30