[Validator] avoid to get information from the cache when we already have them locally (also fixes usage of this class when not using a cache)

This commit is contained in:
Fabien Potencier 2012-06-15 17:30:46 +02:00
parent 7c91ee5755
commit f881d28240
1 changed files with 4 additions and 0 deletions

View File

@ -45,6 +45,10 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
{
$class = ltrim($class, '\\');
if (isset($this->loadedClasses[$class])) {
return $this->loadedClasses[$class];
}
if (null !== $this->cache && false !== ($this->loadedClasses[$class] = $this->cache->read($class))) {
return $this->loadedClasses[$class];
}