With Symfony 2 & Doctrine on a Windows machine I'm trying to
generate entities from an existing schema:
php app/console doctrine:mapping:import --force CoreBundle annotation
generate getters/setters on them:
php app/console doctrine:generate:entities --path=/path/to/codebase/src/MyProject/CoreBundle/Entities CoreBundle
generate REST CRUD controllers on them using Voryx:
php app/console voryx:generate:rest --entity="CoreBundle:User"
The first steps works fine and I can find the entities in my CoreBundle/Entity folder with the correct namespace:
MyVendor\MyProject\CoreBundle\Entity
Good so far. However, running the other 2 commands will fail:
[RuntimeException]
Can't find base path for "CoreBundle" (path:
"\path\to\codebase\src\MyProject\CoreBundle", destination:
"/path/to/codebase/src/MyProject/CoreBundle").
The autoload in my composer.json looks like this:
"autoload": {
"psr-4": {
"MyVendor\\": "src/"
}
},
I found out that Doctrine can't deal with PSR-4 namespaces, that's probably what makes it fail.
I would really like the entities to live in the PSR-4 CoreBundle though - is there a workaround for it?
I tried this, but it doesn't work, either:
"autoload": {
"psr-0": {
"MyVendor\\MyProject\\CoreBundle\\Entity": "src/MyProject/CoreBundle/Entity/"
},
"psr-4": {
"MyVendor\\": "src/"
}
},
Thank you.