當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。