当前位置: 首页>>代码示例>>PHP>>正文


PHP Definition::getParent方法代码示例

本文整理汇总了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);
         }
     }
 }
开发者ID:janmarek,项目名称:autowiring-bundle,代码行数:33,代码来源:AutowiringPass.php

示例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();
     }
 }
开发者ID:eliberty,项目名称:api-bundle,代码行数:17,代码来源:ResourcePass.php

示例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);
 }
开发者ID:lamzin-andrey,项目名称:skyengtt.loc,代码行数:6,代码来源:FrameworkExtensionTest.php

示例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();
     }
 }
开发者ID:mickaelsteinberg,项目名称:BackBee,代码行数:12,代码来源:PhpArrayDumper.php


注:本文中的Symfony\Component\DependencyInjection\Definition::getParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。