public getPropertyInjections ( ) : DI\Definition\ObjectDefinition\PropertyInjection[] | ||
Résultat | 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; }
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); } }
private function mergePropertyInjections(ObjectDefinition $definition) { foreach ($definition->getPropertyInjections() as $propertyName => $propertyInjection) { if (!array_key_exists($propertyName, $this->propertyInjections)) { // Add $this->propertyInjections[$propertyName] = $propertyInjection; } } }