I changed the psr-0 autoloading to psr-4 for a few of my bundles. Now, when I try to generate entities with the app/console command, it gives me
Can't find base path for "MbDbFooBundle" (path: "/home/roland/projects/rolandtest/mbmbisbundle/Symfony/vendor/mb/mb-db-foo-bundle", destination: "/home/roland/projects/rolandtest/mbmbisbundle/Symfony/vendor/mb/mb-db-foo-bundle").
At first I thought it would be a problem with the generated autoloaders. But when I do a new clone of my project, and then run composer update to complete the vendors, it still gives me this error.
PSR-0, also known as the Autoloading Standard, prescribes that classes and namespaces in PHP should match the directory and file structure, and vice-versa. PSR-4 allows specifying a namespace prefix for a given directory explicitly.
This PSR describes a specification for autoloading classes from file paths. It is fully interoperable, and can be used in addition to any other autoloading specification, including PSR-0. This PSR also describes where to place files that will be autoloaded according to the specification.
In regards to the code generation parts of Doctrine, it doesn't support PSR-4. Only PSR-0. The reason is that it directly converts class/namespace paths to filesystem paths (e.g., converting \ to /). This doesn't work for PSR-4 because it allows for namespaces that don't directly correlate with filesystem paths.
https://github.com/doctrine/DoctrineBundle/issues/282
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With