-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Generating entity inside folder eg: Attr\Values, and entity with name Attr already exists #192
Comments
i have the same troubles :
on ubuntu |
i got the same problem, |
weaverryan
added a commit
that referenced
this issue
Aug 29, 2018
weaverryan
added a commit
that referenced
this issue
Aug 29, 2018
This PR was merged into the 1.0-dev branch. Discussion ---------- fix MakerEntity when generating entity inside folder fixes #192 When we're trying to generate an entity inside a folder, and when the namespace of the newly created correspond to an entity that already exists, an error occurs : > In MakeEntity.php line 840: > Call to a member function getName() on string Ex : An entity called App\Entity\BlogPost exists, and we try to create an entity named "BlogPost\Comment" Actually `Str::getNamespace($className)` refers to an existing class and not to a namespace, then $doctrineHelper->getMetadata() won't return an array, but a single metadata, and this leads to an error. To prevent this behavior, the easier way is to put a trailing backslash at the end of the namespace name, so we know it won't refer to a classname. Commits ------- 535c805 fix MakerEntity when generating entity inside folder
Thanks for the report guys! Sorry this bug persisted for a bit - thanks to @nikophil for fixing it :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to generate an entity, using:
php bin/console make:entity
When in the Class name of the entity I put the following value: Attr\Values, and the Attr class already exists, so:
\App\Entity\Attr.php
\App\Entity\Attr\Values.php ( the new one I'm creating ), the following happens:
The curious thing, is that the entity is created, nothing is changed on the Attr entity, and if run the command again to edit the entity Attr\Values, everything is fine, and everything works perfectly.
I'm on Windows 10, and running v1.5.0 of maker-bundle.
The text was updated successfully, but these errors were encountered: