Good. I have one last problem with doctrine: generate: entities command
I run the command below and get the expected file in
/src/MyNamespace/Bundle/MyNamespaceBundle/Resources/config/doctrine/metadata/orm
comamnd:
php app/console doctrine:mapping:convert yml ./src/MyNamespace/Bundle/MyNamespaceBundle/Resources/config/doctrine/metadata/orm --from-database --em=my_manager --filter=TblReports --verbose
I see the TblReports.orm.yml file, and the first line:
TblReports
command: (should this be annotation instead of yml?)
php app/console doctrine:mapping:import MyNamespaceBundle yml --em=my_manager --filter=TblReports
I run the command above. I get the files here.
/src/MyNamespace/Bundle/MyNamespaceBundle/Resources/config/doctrine/
The same name as the first files that were generated from the first command, only in a different place and in the first line (what I assume is the namespace)
TblReports.orm.yml
and now the first line:
MyNamespace\Bundle\MyNamespaceBundle\Entity\TblReports
but I think it should be
MyNamespace\Bundle\MyNamespaceBundle\Entity\Reports\TblReports
Now i run the last command
php app/console doctrine:generate:entities MyNamespaceBundle --path=src --no-backup
I get this error
[RuntimeException] Bundle "MyNamespaceBundle" does not contain any mapped entities.
If I run a command like this
php app/console doctrine:generate:entities MyNamespaceBundle:Reports --path=src --no-backup
I get this error (but the namespace looks right)
[RuntimeException] Namespace "MyNamespace\Bundle\MyNamespaceBundle\Entity\Reports" does not contain any mapped entities.
Here is my_manager (config.yml)
# Doctrine Configuration doctrine: dbal: default_connection: my_database connections: my_database: driver: pdo_pgsql port: 5432 dbname: tbl_reports user: foo_user password: foo_pass charset: UTF8 mapping_types: bit: string orm: auto_generate_proxy_classes: "%kernel.debug%" default_entity_manager: my_manager entity_managers: my_manager: connection: my_database mappings: MyNamespaceBundle: mapping: true dir: Entity/Reports
in config_dev.yml (I use dev and prod yml files to manage hosts that I can connect to)
# Doctrine Configuration doctrine: dbal: connections: my_database: host: 172.0.0.1
Questions:
- Why am I getting this error?
- How can i fix this?
Matters Related:
UPDATE # 1:
Well, I yml second command as annotation instead of yml and the files were generated in:
MyNamespace\Bundle\MyNamespaceBundle\Entity
Team:
php app/console doctrine:mapping:import MyNamespaceBundle annotation --em=my_manager --filter=TblReports
I launched the doctrine: generated: entities (in both directions) and still got errors. I decided to move the files to this directory
MyNamespace\Bundle\MyNamespaceBundle\Entity\Reports
I launched the doctrine: generate: entity agin (in both directions) and still got errors. I looked at the namespace in the files and saw that it points to the namespace of the work. I updated from:
MyNamespace\Bundle\MyNamespaceBundle\Entity\TblReports
to
MyNamespace\Bundle\MyNamespaceBundle\Entity\Reports\TblReports
executed this command
php app/console doctrine:generate:entities MyNamespaceBundle:Reports --path=src --no-backup
and now it works
Generating entities for namespace "MyNamespace\Bundle\MyNamespaceBundle\Entity\Reports"
So, I ask question number 3:
- How can I get a second command to add the correct namespace when importing?
I tried this, but not a cube
php app/console doctrine:mapping:import MyNamespaceBundle:Reports annotation --em=my_manager --filter=TblReports
Docs:
A source: