getPropertyInjections() public method

public getPropertyInjections ( ) : DI\Definition\ObjectDefinition\PropertyInjection[]
return DI\Definition\ObjectDefinition\PropertyInjection[] Property injections
 private function dumpProperties(ObjectDefinition $definition)
 {
     $str = '';
     foreach ($definition->getPropertyInjections() as $propertyInjection) {
         $value = $propertyInjection->getValue();
         if ($value instanceof EntryReference) {
             $valueStr = sprintf('get(%s)', $value->getName());
         } else {
             $valueStr = var_export($value, true);
         }
         $str .= sprintf(PHP_EOL . "    \$%s = %s", $propertyInjection->getPropertyName(), $valueStr);
     }
     return $str;
 }
Beispiel #2
0
 protected function injectMethodsAndProperties($object, ObjectDefinition $objectDefinition)
 {
     // Property injections
     foreach ($objectDefinition->getPropertyInjections() as $propertyInjection) {
         $this->injectProperty($object, $propertyInjection);
     }
     // Method injections
     foreach ($objectDefinition->getMethodInjections() as $methodInjection) {
         $methodReflection = new \ReflectionMethod($object, $methodInjection->getMethodName());
         $args = $this->parameterResolver->resolveParameters($methodInjection, $methodReflection);
         $methodReflection->invokeArgs($object, $args);
     }
 }
Beispiel #3
0
 private function mergePropertyInjections(ObjectDefinition $definition)
 {
     foreach ($definition->getPropertyInjections() as $propertyName => $propertyInjection) {
         if (!array_key_exists($propertyName, $this->propertyInjections)) {
             // Add
             $this->propertyInjections[$propertyName] = $propertyInjection;
         }
     }
 }