Skip to content
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

Provide a way to extend EntityGenerator #6277

Closed
nreynis opened this issue Feb 6, 2017 · 3 comments
Closed

Provide a way to extend EntityGenerator #6277

nreynis opened this issue Feb 6, 2017 · 3 comments

Comments

@nreynis
Copy link

nreynis commented Feb 6, 2017

There is currently no way to extend the EntityGenerator.
You can make custom types but the stubs methods will always be generic getters and setters. Which can, with certain types be really innapropriate.

It would be really useful to have a way to interact with EntityGenerator->generateEntityStubMethods.

@Ocramius
Copy link
Member

Ocramius commented Feb 6, 2017

Not gonna happen: there are other components for this (such as https://github.com/zendframework/zend-code), as well as IDEs that can generate methods for you.

The code generator in doctrine ORM is just meant to get you kickstarted once at the beginning of a project, and then you are supposed to edit the code yourself, manually.

Ref: symfony/symfony-docs#5070
Ref: doctrine/DoctrineBundle#412
Ref: #5733

@nreynis
Copy link
Author

nreynis commented Feb 6, 2017

Ok, I get it. But still if I can't customize the stubs for my custom type is there a way to prevent the incorrect getters/setters being generated ?

Let's take a practical example, if I got a Set datatype I'll want add, remove and get methods. But the entity generator will keep on adding a set method. What's the best practice here ?

@Ocramius
Copy link
Member

Ocramius commented Feb 6, 2017

What's the best practice here ?

@ywg grepping the set methods, then removing manually

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants