本文整理汇总了PHP中Symfony\Component\DependencyInjection\Definition::getParent方法的典型用法代码示例。如果您正苦于以下问题:PHP Definition::getParent方法的具体用法?PHP Definition::getParent怎么用?PHP Definition::getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\DependencyInjection\Definition
的用法示例。
在下文中一共展示了Definition::getParent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: autowireConstructor
/**
* @param string $class
* @param Definition $definition
* @param string[] $classes
* @param string $id
* @param ContainerBuilder $container
*/
private function autowireConstructor($class, Definition $definition, array $classes, $id, ContainerBuilder $container)
{
$reflection = new ReflectionClass($class);
$constructor = $reflection->getConstructor();
// service not created by factory with public constructor with not fully configured arguments
if ($constructor !== NULL && $constructor->isPublic() && $definition->getFactoryMethod() === NULL) {
$autowiredArgs = $this->autowireMethod($constructor, $definition->getArguments(), $classes, $id, $container);
if ($definition instanceof DefinitionDecorator && $definition->getParent() !== NULL) {
$parentDef = $container->getDefinition($definition->getParent());
$parentDefArgsCount = count($parentDef->getArguments());
$argsToReplace = array();
foreach ($autowiredArgs as $i => $arg) {
if ($i < $parentDefArgsCount) {
$argsToReplace[$i] = $arg;
unset($autowiredArgs[$i]);
}
}
$definition->setArguments($autowiredArgs);
foreach ($argsToReplace as $i => $arg) {
$definition->replaceArgument($i, $arg);
}
} else {
$definition->setArguments($autowiredArgs);
}
}
}
示例2: getClass
/**
* Gets class of the given definition.
*
* @param ContainerBuilder $container
* @param Definition $definition
*
* @return string|null
*/
private function getClass(ContainerBuilder $container, Definition $definition)
{
if ($class = $definition->getClass()) {
return $class;
}
if ($definition instanceof DefinitionDecorator) {
return $container->getDefinition($definition->getParent())->getClass();
}
}
示例3: assertUrlPackage
private function assertUrlPackage(ContainerBuilder $container, Definition $package, $baseUrls, $version, $format)
{
$this->assertEquals('assets.url_package', $package->getParent());
$this->assertEquals($baseUrls, $package->getArgument(0));
$this->assertVersionStrategy($container, $package->getArgument(1), $version, $format);
}
示例4: hydrateDefinitionParent
/**
* Try to hydrate definition array method calls with definition entity.
*
* @param Definition $definition the definition to convert
* @param array $definitionArray the definition array (passed by reference)
*/
private function hydrateDefinitionParent(Definition $definition, array &$definitionArray)
{
if ($definition instanceof DefinitionDecorator) {
$definitionArray['parent'] = $definition->getParent();
}
}