DI\Definition\ObjectDefinition::setConstructorInjection PHP Méthode

setConstructorInjection() public méthode

public setConstructorInjection ( DI\Definition\ObjectDefinition\MethodInjection $constructorInjection )
$constructorInjection DI\Definition\ObjectDefinition\MethodInjection
    public function setConstructorInjection(MethodInjection $constructorInjection)
    {
        $this->constructorInjection = $constructorInjection;
    }

Usage Example

Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function getDefinition($name)
 {
     if (!class_exists($name) && !interface_exists($name)) {
         return null;
     }
     $definition = new ObjectDefinition($name);
     // Constructor
     $class = new \ReflectionClass($name);
     $constructor = $class->getConstructor();
     if ($constructor && $constructor->isPublic()) {
         $definition->setConstructorInjection(MethodInjection::constructor($this->getParametersDefinition($constructor)));
     }
     return $definition;
 }
All Usage Examples Of DI\Definition\ObjectDefinition::setConstructorInjection