-
-
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
Add support for enum arguments to setValue() #343
Add support for enum arguments to setValue() #343
Conversation
@@ -86,13 +86,25 @@ private function fromEnum($enum) | |||
} | |||
|
|||
/** | |||
* @param int|string|int[]|string[] $value | |||
* @param int|string|int[]|string[]|BackedEnum|BackedEnum[] $value | |||
* | |||
* @return ($value is int|string ? BackedEnum : BackedEnum[]) |
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.
* @return ($value is int|string ? BackedEnum : BackedEnum[]) | |
* @return ($value is int|string|BackedEnum ? BackedEnum : BackedEnum[]) |
This should take down one SA baseline entry
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.
Didn't seem to, but good point anyway.
if (is_array($value)) { | ||
foreach ($value as $v) { |
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.
This was hard to read for me (maybe because I'm in vacations-mode ;)... IMO using reset
would be more elegant than this entire loop
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.
Enjoy your vacation!
The ORM is relying on that feature.
a102634
to
e70bc39
Compare
The ORM is relying on that feature.
When trying to use
EnumReflectionProperty
instead of the corresponding class, the test suite breaks on this line: https://github.com/doctrine/orm/blob/b187bc85881cc85d36b28e7ed9dbe2071d472e30/src/UnitOfWork.php#L2406EnumReflectionProperty
was added #248 so that it could reduce duplication with the ORM, but is not used yet.