Open gharlan opened 10 years ago
Well, why not...
It is an improvement, not scheduled yet.
Would actually be nice to have it. @gharlan any chance you can provide a PR?
Actually, in order to get the psr-4 location, composer.json must be read to get the correct location. Bascially, for any psr (psr-0 and psr-4) this would mean an auto-target-location. Propel reads the autoload-part of composer.json and whenever it is possible to match namespaces, the detected location is used. For everything else the target-option is used, kinda as a fallback.
I actually think, this isn't a nice to have, because at the moment, it is required to build your own buildscript around propel that deals with the paths, instead of just run propel from the command line.
I ran into the same issue today. Using Propel with Symfony2 Bundles installed by composer and configured to use PSR-4 won't work, the generated files end up in the wrong location.
Since it looks like everyone is keen to upgrade to PSR-4 I fear this will become a blocker soon.
I guess a option like --set-namespace-path
at the build
command would be enough to achieve that (with a configuration possibility as well). At the moment the file path is based on the namespace of the model and IIRC PSR-4 only defines that you're allowed to use different file paths than the namespace of the class.
Default: Propel\Bookstore\Models\Author => ./Propel/Bookstore/Models/Author.php
With --set-namespace-path=./Models/
=> ./Models/Author.php
What about specifying the path in the schema next to the namespace?
Yeah, that would be the with a configuration possibility as well
:-)
Any updates on this issue?
No
It should be possible to use PSR-4 for generated model classes. Correct me if I'm wrong, but at the moment Propel2 supports PSR-0 only.