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

Fix context unique #406

Merged
merged 7 commits into from
Apr 22, 2014
Merged

Fix context unique #406

merged 7 commits into from
Apr 22, 2014

Conversation

bakura10
Copy link
Member

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 :).

@bakura10
Copy link
Member Author

Shit, some ugly commits...

@@ -151,6 +151,12 @@ protected function getExpectedIdentifiers(array $context = null)
);
}

if (is_object($context)) {
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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

bakura10 added a commit that referenced this pull request Apr 22, 2014
@bakura10 bakura10 merged commit caa617a into doctrine:master Apr 22, 2014
@bakura10 bakura10 deleted the fix-context-unique branch April 22, 2014 09:57
@gianarb gianarb mentioned this pull request Mar 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants