Reputation: 867
I wanted to create an entity, basing on a database table. I followed these steps: Doctrine/Symfony entity generator and generating entity from one table , that is, in terminal:
php bin/console doctrine:mapping:import --force AppBundle yml --force --filter="Client"
php bin/console doctrine:mapping:convert annotation ./src/AppBundle/Entity --from-database --filter="Client"
php bin/console doctrine:generate:entities AppBundle:Client --no-backup
This created the entity "Client". But, it also created a client.orm.yml file in the src/AppBundle/Resources/config/doctrine directory. And this causes problems - that is, my application now crashes with an error message:
"No mapping file found named 'User.orm.yml' for class 'AppBundle\Entity\User'"
I think Symfony/Doctrine started using those yml files to map my php code to database schema. But why? I didn't want it. I just wanted Doctrine to create an entity.
p.s. When I remove this client.orm.yml file, everything works fine. But I don't understand what is happening, and how should I handle it properly.
Upvotes: 0
Views: 593
Reputation: 1071
You can delete these files after entity creation process. These files for metadata mapping.
You can read this martinfowler.com/eaaCatalog/metadataMapping.html and martinfowler.com/eaaCatalog/dataMapper.html
Why doctrine does not delete ? Because, it is first step for convert process. Your first command creating those files after you command to doctrine and it is creating Entity files referenced with those files. :)
Upvotes: 2