-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
Fix context unique #406
Fix context unique #406
Conversation
Shit, some ugly commits... |
@@ -151,6 +151,12 @@ protected function getExpectedIdentifiers(array $context = null) | |||
); | |||
} | |||
|
|||
if (is_object($context)) { |
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.
Are you sure that $context is an instance of this repository's class?
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.
No. We could add a check.
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.
Yeah, this code block should really be reached only if $className = $this->objectRepository->getClassName() && $context instanceof $className
Hi,
UniqueValidator had a "use_context" option that could be set to false, however it could not work because the "getExpectedIdentifiers" was set to typehint to array, hence resulting in a runtime error.
It now makes the "use_context" option usable, by allowing to fetch identifiers from the instance.
Please merge asap :).