New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduced skipNamespaceInPath and skipNamespacePartInPath properties #1356
Introduced skipNamespaceInPath and skipNamespacePartInPath properties #1356
Conversation
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DDC-3649 We use Jira to track the state of pull requests and the versions they got |
@ancpru This will probably need some new tests. |
So i propably copy testGeneratedEntityClass() and testEntityUpdatingWorks() and perform them with the new options, right? |
@ancpru that would be a good start I think. |
As discussed multiple times in the past, the generator does not support PSR-4 style paths nor does need to: simply move the files after having generated them. I'm very unlikely going to merge further generator overhauls unless it gets split into a separate project: this thing is already too big/complex and does more damage than what it solves. |
Ok, I guess i will drop this under this circumstances. IMO, the generate/move-approach is an unpleasant workaround because it does not work well with updates. Class updates would require copying the current source into the temporary directory, run the generator over them, and then copy them back. The reason I made this change was, that the PSR-1 namespace does not fit into my projects and I needed to update entity classes quite often, esp. during the development process. But I guess I will drop this change if it won't get merged and look for a seperate workaround. And yes, I agree that it's already quite complex. |
@ancpru it could really be a good idea to start segregating the generator into its own project, heh... |
Closing this as we will be removing EntityGenerator in Doctrine 3.0. |
Hi All,
I've extended the EntityGenerator in order to make handling of namespaces more flexible. Currently the EntityGenerator class creates a full tree based on the namespace under the output-directory. This causes problems in a PSR-4-like environment. Thus, i've introduced two properties in order to manipulate the target path:
skipNamespaceInPath: if true, every class file is put directly into the output-directory. if false (which is the default and equal to the current behaviour), subdirectories based on the namespace are generated.
skipNamespacePartInPath: the part of the namespace to skip, for example if the namespace is 'Foo\Bar\Entities\MyEntity', and skipNamespacePartInPath is set to 'Foo\Bar', the entity MyEntity is generated in the directory 'Entities' under the output-directory.
Andreas