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


PHP Container::getParameter方法代码示例

本文整理汇总了PHP中Container::getParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::getParameter方法的具体用法?PHP Container::getParameter怎么用?PHP Container::getParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Container的用法示例。


在下文中一共展示了Container::getParameter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: warmUp

 public function warmUp($cacheDir)
 {
     // we need the directory no matter the hydrator cache generation strategy.
     $hydratorCacheDir = $this->container->getParameter('doctrine_mongodb.odm.hydrator_dir');
     if (!file_exists($hydratorCacheDir)) {
         if (false === @mkdir($hydratorCacheDir, 0777, true)) {
             throw new \RuntimeException(sprintf('Unable to create the Doctrine Hydrator directory (%s)', dirname($hydratorCacheDir)));
         }
     } else {
         if (!is_writable($hydratorCacheDir)) {
             throw new \RuntimeException(sprintf('Doctrine Hydrator directory (%s) is not writable for the current system user.', $hydratorCacheDir));
         }
     }
     // if hydrators are autogenerated we don't need to generate them in the cache warmer.
     if ($this->container->getParameter('doctrine_mongodb.odm.auto_generate_hydrator_classes') === true) {
         return;
     }
     /* @var $registry \Doctrine\Common\Persistence\ManagerRegistry */
     $registry = $this->container->get('doctrine_mongodb');
     foreach ($registry->getManagers() as $dm) {
         /* @var $dm \Doctrine\ODM\MongoDB\DocumentManager */
         $classes = $dm->getMetadataFactory()->getAllMetadata();
         $dm->getHydratorFactory()->generateHydratorClasses($classes);
     }
 }
开发者ID:pnvasanth,项目名称:DoctrineMongoDBBundle,代码行数:25,代码来源:HydratorCacheWarmer.php

示例2: __construct

 /**
  * Initialize the router object.
  *
  * @param Container $container
  */
 public function __construct($container)
 {
     $this->container = $container;
     $this->request = new Request($container->get('request'));
     $this->response = new Response($this->request->getCallType(), $this->request->isUpload());
     $this->defaultAccess = $container->getParameter('direct.api.default_access');
     $this->session = $this->container->get('session')->get($container->getParameter('direct.api.session_attribute'));
 }
开发者ID:modera,项目名称:foundation,代码行数:13,代码来源:Router.php

示例3: resolve

 /**
  * Return the resolved value of the given reference
  * @param  mixed $reference
  * @return mixed
  */
 public function resolve($reference)
 {
     if (!is_string($reference)) {
         return $reference;
     }
     $prefix = substr($reference, 0, 1);
     switch (1) {
         case $prefix === '@':
             return $this->container->get(substr($reference, 1));
         case $prefix === '%':
             return $this->container->getParameter(substr($reference, 1));
         case preg_match(static::CONTAINER_REGEXP, $reference, $matches):
             return $this->container;
         case preg_match(static::ENVIRONMENT_REGEXP, $reference, $matches):
             return getenv($matches[1]);
         case preg_match(static::CONSTANT_REGEXP, $reference, $matches):
             return constant($matches[1]);
         default:
             return $reference;
     }
 }
开发者ID:evaneos,项目名称:dic-it,代码行数:26,代码来源:ReferenceResolver.php

示例4: updateEntity

 /**
  *
  * @param Object $entity The entity
  * @param Blameable $blameable The blameable annotation
  * @param boolean $create
  */
 protected function updateEntity($entity, $blameable, $create = false)
 {
     if ($blameable->getUserClass() === NULL) {
         if ($this->container->hasParameter('pss.blameable.user_class')) {
             $blameable->setUserClass($this->container->getParameter('pss.blameable.user_class'));
         } else {
             throw new \InvalidArgumentException('You must define a "userClass" attribute or "user_class" config.');
         }
     }
     $user = $this->container->get('security.context')->getToken()->getUser();
     if ($user instanceof \Symfony\Component\Security\Core\User\UserInterface) {
         if (method_exists($user, 'getId')) {
             $userId = $user->getId();
         } else {
             $userId = $user->getUsername();
         }
     } else {
         $userId = NULL;
     }
     if ($create) {
         // save user class name?
         // $entity->setUserClass($blameable->getUserClass());
         $creatorSetter = 'set' . $blameable->getCreator();
         // Test to store the object or the id/username
         if ($this->container->getParameter('pss.blameable.store_object')) {
             $entity->{$creatorSetter}($user ? $user : null);
         } else {
             $entity->{$creatorSetter}($userId);
         }
     }
     $updaterSetter = 'set' . $blameable->getUpdater();
     // Test to store the object or the id/username
     if ($this->container->getParameter('pss.blameable.store_object')) {
         $entity->{$updaterSetter}($user ? $user : null);
     } else {
         $entity->{$updaterSetter}($userId);
     }
 }
开发者ID:rafaelgou,项目名称:PSSDoctrineExtensionsBundle,代码行数:44,代码来源:AbstractBlameableListener.php


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