Symfony\Component\DependencyInjection\Definition::isSynthetic PHP Method

isSynthetic() public method

Whether this definition is synthetic, that is not constructed by the container, but dynamically injected.
public isSynthetic ( ) : boolean
return boolean
    public function isSynthetic()
    {
        return $this->synthetic;
    }

Usage Example

 /**
  * @param Definition $definition
  */
 protected function processDefinition(Definition $definition)
 {
     if ($definition->isSynthetic()) {
         return;
     }
     if ($definition->getFactoryService() || $definition->getFactoryClass()) {
         return;
     }
     if ($file = $definition->getFile()) {
         require_once $file;
     }
     if (!class_exists($definition->getClass())) {
         return;
     }
     $class = new \ReflectionClass($definition->getClass());
     if (!$class->implementsInterface(static::INTERFACE_CLASS)) {
         return;
     }
     $metadata = $this->getMetadataFactory()->getMetadataForClass($definition->getClass());
     if (!$metadata instanceof ClassMetadata) {
         return;
     }
     $namespace = $metadata->getNamespace() ?: static::ROOT_NAMESPACE;
     $serviceName = static::PROVIDER_PREFIX . substr(sha1($namespace), 0, 10);
     if (!$this->container->hasDefinition($serviceName)) {
         $cacher = new Definition('Werkint\\Bundle\\CacheBundle\\Service\\CacheProvider', [$this->container->getParameter('kernel.cache_dir') . '/werkint_cache']);
         $cacher->setPublic(true);
         $cacher->addMethodCall('setNamespace', [$namespace]);
         $this->container->setDefinition($serviceName, $cacher);
     }
     $definition->addMethodCall('setCacheProvider', [new Reference($serviceName)]);
 }
All Usage Examples Of Symfony\Component\DependencyInjection\Definition::isSynthetic