Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ObjectChoiceList closed for extension? #13459

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

Closed
flip111 opened this issue Jan 19, 2015 · 8 comments
Closed

ObjectChoiceList closed for extension? #13459

flip111 opened this issue Jan 19, 2015 · 8 comments

Comments

@flip111
Copy link
Contributor

flip111 commented Jan 19, 2015

https://github.com/symfony/Form/blob/master/Extension/Core/ChoiceList/ObjectChoiceList.php#L48

Why is this property set to private and not protected? I would like to use this property in my child class. Will access to this property modify the operation of the parent class too much? Not sure were this stands on the open/closed principle.

Thanks for support

@merk
Copy link
Contributor

merk commented Jan 19, 2015

Why cant you call the parent constructor with the property path you require from your inheriting class?

@flip111
Copy link
Contributor Author

flip111 commented Jan 20, 2015

I can, wouldn't that just be a workaround though?

@merk
Copy link
Contributor

merk commented Jan 20, 2015

Doesnt seem like a workaround to me.

@stof
Copy link
Member

stof commented Jan 26, 2015

@flip111 making everything protected is not about opening for extension. It is about opening for hacking by allowing to access all internal state. Calling the parent constructor is not a hack (avoiding to call a parent constructor could be considered as a hack as it might leave the class in a broken state)

@flip111
Copy link
Contributor Author

flip111 commented Jan 26, 2015

@stof in this particular case would it be a hack as well? If so i will close the issue.

@merk
Copy link
Contributor

merk commented Jan 26, 2015

Its an optional argument, if you dont want to provide it you don't have to - as long as you still call the parent constructor.

@HeahDude
Copy link
Contributor

HeahDude commented Mar 8, 2016

The ObjectChoiceList class has been deprecated in 2.7 and removed in 3.0. The current ChoiceListFactory allow dynamic parameters.

Should be closed as fixed by #14050 imo.

@jakzal
Copy link
Contributor

jakzal commented Mar 8, 2016

@flip111 I'll close this for now. If you'd like some other property visibility to be changed, please provide a justification (a use case). Thank you.

@jakzal jakzal closed this as completed Mar 8, 2016
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

7 participants