Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function warmUp($cacheDir)
 {
     $adapter = new PhpArrayAdapter($this->phpArrayFile, $this->fallbackPool);
     $annotatedClassPatterns = $cacheDir . '/annotations.map';
     if (!is_file($annotatedClassPatterns)) {
         $adapter->warmUp(array());
         return;
     }
     $annotatedClasses = (include $annotatedClassPatterns);
     $arrayPool = new ArrayAdapter(0, false);
     $reader = new CachedReader($this->annotationReader, new DoctrineProvider($arrayPool));
     $throwingAutoloader = function ($class) {
         throw new \ReflectionException(sprintf('Class %s does not exist', $class));
     };
     spl_autoload_register($throwingAutoloader);
     try {
         foreach ($annotatedClasses as $class) {
             try {
                 $this->readAllComponents($reader, $class);
             } catch (\ReflectionException $e) {
                 // ignore failing reflection
             }
         }
     } finally {
         spl_autoload_unregister($throwingAutoloader);
     }
     $values = $arrayPool->getValues();
     $adapter->warmUp($values);
     foreach ($values as $k => $v) {
         $item = $this->fallbackPool->getItem($k);
         $this->fallbackPool->saveDeferred($item->set($v));
     }
     $this->fallbackPool->commit();
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function warmUp($cacheDir)
 {
     if (!class_exists(CacheClassMetadataFactory::class) || !method_exists(XmlFileLoader::class, 'getMappedClasses') || !method_exists(YamlFileLoader::class, 'getMappedClasses')) {
         return;
     }
     $adapter = new PhpArrayAdapter($this->phpArrayFile, $this->fallbackPool);
     $arrayPool = new ArrayAdapter(0, false);
     $metadataFactory = new CacheClassMetadataFactory(new ClassMetadataFactory(new LoaderChain($this->loaders)), $arrayPool);
     foreach ($this->extractSupportedLoaders($this->loaders) as $loader) {
         foreach ($loader->getMappedClasses() as $mappedClass) {
             $metadataFactory->getMetadataFor($mappedClass);
         }
     }
     $values = $arrayPool->getValues();
     $adapter->warmUp($values);
     foreach ($values as $k => $v) {
         $item = $this->fallbackPool->getItem($k);
         $this->fallbackPool->saveDeferred($item->set($v));
     }
     $this->fallbackPool->commit();
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function warmUp($cacheDir)
 {
     $adapter = new PhpArrayAdapter($this->phpArrayFile, $this->fallbackPool);
     $annotatedClassPatterns = $cacheDir . '/annotations.map';
     if (!is_file($annotatedClassPatterns)) {
         $adapter->warmUp(array());
         return;
     }
     $annotatedClasses = (include $annotatedClassPatterns);
     $arrayPool = new ArrayAdapter(0, false);
     $reader = new CachedReader($this->annotationReader, new DoctrineProvider($arrayPool));
     foreach ($annotatedClasses as $class) {
         $this->readAllComponents($reader, $class);
     }
     $values = $arrayPool->getValues();
     $adapter->warmUp($values);
     foreach ($values as $k => $v) {
         $item = $this->fallbackPool->getItem($k);
         $this->fallbackPool->saveDeferred($item->set($v));
     }
     $this->fallbackPool->commit();
 }
Esempio n. 4
0
 /**
  * {@inheritdoc}
  */
 public function warmUp($cacheDir)
 {
     if (!method_exists($this->validatorBuilder, 'getLoaders')) {
         return;
     }
     $adapter = new PhpArrayAdapter($this->phpArrayFile, $this->fallbackPool);
     $arrayPool = new ArrayAdapter(0, false);
     $loaders = $this->validatorBuilder->getLoaders();
     $metadataFactory = new LazyLoadingMetadataFactory(new LoaderChain($loaders), new Psr6Cache($arrayPool));
     foreach ($this->extractSupportedLoaders($loaders) as $loader) {
         foreach ($loader->getMappedClasses() as $mappedClass) {
             $metadataFactory->getMetadataFor($mappedClass);
         }
     }
     $values = $arrayPool->getValues();
     $adapter->warmUp($values);
     foreach ($values as $k => $v) {
         $item = $this->fallbackPool->getItem($k);
         $this->fallbackPool->saveDeferred($item->set($v));
     }
     $this->fallbackPool->commit();
 }
Esempio n. 5
0
 /**
  * {@inheritdoc}
  */
 public function warmUp($cacheDir)
 {
     if (!method_exists($this->validatorBuilder, 'getLoaders')) {
         return;
     }
     $adapter = new PhpArrayAdapter($this->phpArrayFile, $this->fallbackPool);
     $arrayPool = new ArrayAdapter(0, false);
     $loaders = $this->validatorBuilder->getLoaders();
     $metadataFactory = new LazyLoadingMetadataFactory(new LoaderChain($loaders), new Psr6Cache($arrayPool));
     $throwingAutoloader = function ($class) {
         throw new \ReflectionException(sprintf('Class %s does not exist', $class));
     };
     spl_autoload_register($throwingAutoloader);
     try {
         foreach ($this->extractSupportedLoaders($loaders) as $loader) {
             foreach ($loader->getMappedClasses() as $mappedClass) {
                 try {
                     if ($metadataFactory->hasMetadataFor($mappedClass)) {
                         $metadataFactory->getMetadataFor($mappedClass);
                     }
                 } catch (\ReflectionException $e) {
                     // ignore failing reflection
                 }
             }
         }
     } finally {
         spl_autoload_unregister($throwingAutoloader);
     }
     $values = $arrayPool->getValues();
     $adapter->warmUp($values);
     foreach ($values as $k => $v) {
         $item = $this->fallbackPool->getItem($k);
         $this->fallbackPool->saveDeferred($item->set($v));
     }
     $this->fallbackPool->commit();
 }
Esempio n. 6
0
 protected function getValidator_BuilderService()
 {
     $this->services['validator.builder'] = $instance = \Symfony\Component\Validator\Validation::createValidatorBuilder();
     $instance->setConstraintValidatorFactory(new \Symfony\Bundle\FrameworkBundle\Validator\ConstraintValidatorFactory($this, array('validator.expression' => 'validator.expression', 'Symfony\\Component\\Validator\\Constraints\\ExpressionValidator' => 'validator.expression', 'Symfony\\Component\\Validator\\Constraints\\EmailValidator' => 'validator.email', 'security.validator.user_password' => 'security.validator.user_password', 'Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPasswordValidator' => 'security.validator.user_password')));
     $instance->setTranslator($this->get('translator'));
     $instance->setTranslationDomain('validators');
     $instance->addXmlMappings(array(0 => $this->targetDirs[3] . '/vendor/symfony/symfony/src/Symfony/Component/Form/Resources/config/validation.xml'));
     $instance->enableAnnotationMapping($this->get('annotation_reader'));
     $instance->addMethodMapping('loadValidatorMetadata');
     $instance->setMetadataCache(new \Symfony\Component\Validator\Mapping\Cache\Psr6Cache(\Symfony\Component\Cache\Adapter\PhpArrayAdapter::create(__DIR__ . '/validation.php', ${($_ = isset($this->services['cache.validator']) ? $this->services['cache.validator'] : $this->getCache_ValidatorService()) && false ?: '_'})));
     $instance->addObjectInitializers(array());
     return $instance;
 }
 /**
  * Gets the 'annotation_reader' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Doctrine\Common\Annotations\CachedReader A Doctrine\Common\Annotations\CachedReader instance
  */
 protected function getAnnotationReaderService()
 {
     return $this->services['annotation_reader'] = new \Doctrine\Common\Annotations\CachedReader(${($_ = isset($this->services['annotations.reader']) ? $this->services['annotations.reader'] : $this->getAnnotations_ReaderService()) && false ?: '_'}, new \Symfony\Component\Cache\DoctrineProvider(\Symfony\Component\Cache\Adapter\PhpArrayAdapter::create(__DIR__ . '/annotations.php', ${($_ = isset($this->services['cache.annotations']) ? $this->services['cache.annotations'] : $this->getCache_AnnotationsService()) && false ?: '_'})), true);
 }