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

[Validator] Fix issue 12302 - cache constraints #20740

Closed
wants to merge 2 commits into from

Conversation

uwej711
Copy link
Contributor

@uwej711 uwej711 commented Dec 3, 2016

Q A
Branch? "master" for new features / 2.7, 2.8 or 3.1 for fixes
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #12302
License MIT
Doc PR -

This change allows to still cache constraints even when an un-cachable constraint (i.e. Callback)
is added to a parent class at runtime.

This is achieved by caching the constraints that are loaded for the class in question only
and merging parent and interface constraints after reading from cache.

This change allows to still cache constraints even when an uncachable constraint (i.e. Callback)
is added to a parent class at runtime.

This is achived by caching only the constraints that are loaded for the class in question only
and merging parent and interface constraints after reading from cache.
'Entity',
))),

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra line

@@ -43,10 +44,9 @@ public function testMergeParentConstraints()
$metadata = $factory->getMetadataFor(self::CLASS_NAME);

$constraints = array(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra line

$factory = new LazyLoadingMetadataFactory(new TestLoader(), $cache);

$cache
->expects($this->any())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 spaces indendation (same below)

return $this->loadedClasses[$class] = $metadata;
}

protected function mergeConstraints(ClassMetadata $metadata)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be made private?

@nicolas-grekas
Copy link
Member

If this is a bug, it should be submitted again the lowest branch where it applies. Do you know which branch this should be? Can you rebase + change the base branch on github (click on "Edit" near the PR title).

@uwej711
Copy link
Contributor Author

uwej711 commented Dec 6, 2016

This was already present in 2.3 but as I understand, this version is not maintained any more so I will look at the 2.7 branch.

@uwej711
Copy link
Contributor Author

uwej711 commented Dec 6, 2016

See #20793

@uwej711 uwej711 closed this Dec 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants