-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Bugfix: Parent methods in extended EnumReflectionProperty didn't work. #342
Conversation
d41eefb
to
2ea3a44
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not calling the parent constructor was on purpose because this class is meant to be a decorator. Calls to methods like the ones you mentioned should be proxied to $this->originalReflectionProperty
instead. We apparently had no need for them yet, but I'd happily merge any PR that adds those two methods to the EnumReflectionProperty
class.
If it is a decorator, then it should implement all parent methods, not just the two I mentioned. Without them, EnumReflectionProperty is inconsistent, and calling any of the parent methods will throw an exception, affecting third-party software that relies on the ReflectionProperty interface (this is what I encountered with). I've seen the same solution in Doctrine ORM ReflectionEnumProperty.php and it was accepted. |
Yes, it's currently incomplete.
Your change makes it an inconsistent decorator.
Can you elaborate on this? I'm having a hard time finding out where this class is actually used.
I think, this change was okay-ish for the ORM because it's an internal class there. I would evaluate it differently for this library. The existence of a |
I encountered with issues trying to dump entity fetched by MongoDB ODM in symfony dumper.
Isn't it internal as well? |
Okay, so the ODM does use it. That answers my question.
Right, we should fix the decorator then.
It's not internal to the persistence library, no. |
EDIT: Ah, it's called one way in the ORM, and the other way in persistence 😅 The ORM class was added in doctrine/orm#9304 |
So what is the conclusion? How do you see the solution? |
Let's add the missing proxy methods that we need. Alternatively, we could consider patching |
I've also encounted this with the same use-case as: #342 (comment) Spits out the error: Confirming this merge request does "fix" it, meaning gets past the error, not sure if it actually does what's intended or not though. I also tried adding the
|
#351 was merged and released last week. So given it fixes same issue we're good to close this one? |
Ah perfect, yes that should resolve this, good to close I'd say. |
Cool! Thanks @luzrain for your work on this PR! |
EnumReflectionProperty extends ReflectionProperty without ReflectionProperty::__constructor() call making it impossible to use parent methods such as ReflectionProperty::getAttributes() and others.