Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cb12f22

Browse files
Seldaekfabpot
authored andcommitted
[FrameworkBundle] Avoid warming up the validator cache for non-existent classes
1 parent 2094715 commit cb12f22

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ public function warmUp($cacheDir)
6868

6969
foreach ($this->extractSupportedLoaders($loaders) as $loader) {
7070
foreach ($loader->getMappedClasses() as $mappedClass) {
71-
$metadataFactory->getMetadataFor($mappedClass);
71+
if ($metadataFactory->hasMetadataFor($mappedClass)) {
72+
$metadataFactory->getMetadataFor($mappedClass);
73+
}
7274
}
7375
}
7476

src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Validation/Resources/person.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,15 @@
1515
</constraint>
1616
</property>
1717
</class>
18+
19+
<class name="Symfony\Bundle\FrameworkBundle\Tests\Fixtures\Validation\NonExistentClass">
20+
<property name="gender">
21+
<constraint name="Choice">
22+
<option name="choices">
23+
<value>other</value>
24+
</option>
25+
<option name="message">This should be ignored.</option>
26+
</constraint>
27+
</property>
28+
</class>
1829
</constraint-mapping>

0 commit comments

Comments
 (0)