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


PHP Container::getParameter方法代码示例

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


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

示例1: warmUp

 public function warmUp($cacheDir)
 {
     // we need the directory no matter the proxy cache generation strategy.
     $proxyCacheDir = $this->container->getParameter('doctrine.orm.proxy_dir');
     if (!file_exists($proxyCacheDir)) {
         if (false === @mkdir($proxyCacheDir, 0777, true)) {
             throw new \RuntimeException(sprintf('Unable to create the Doctrine Proxy directory (%s)', dirname($proxyCacheDir)));
         }
     } else {
         if (!is_writable($proxyCacheDir)) {
             throw new \RuntimeException(sprintf('Doctrine Proxy directory (%s) is not writeable for the current system user.', $proxyCacheDir));
         }
     }
     // if proxys are autogenerated we don't need to generate them in the cache warmer.
     if ($this->container->getParameter('doctrine.orm.auto_generate_proxy_classes') === true) {
         return;
     }
     $entityManagers = $this->container->getParameter('doctrine.orm.entity_managers');
     foreach ($entityManagers as $entityManagerName) {
         $em = $this->container->get(sprintf('doctrine.orm.%s_entity_manager', $entityManagerName));
         /* @var $em Doctrine\ORM\EntityManager */
         $classes = $em->getMetadataFactory()->getAllMetadata();
         $em->getProxyFactory()->generateProxyClasses($classes);
     }
 }
开发者ID:nickaggarwal,项目名称:sample-symfony2,代码行数:25,代码来源:ProxyCacheWarmer.php

示例2: renderMedia

 /**
  * Renders jwplayer
  * 
  * @param MediaInterface $media
  * @param array $options
  * 
  * @return string
  */
 public function renderMedia(MediaInterface $media, array $options = array())
 {
     $defaultOptions = $this->container->getParameter('thrace_media.jwplayer.options');
     $configs = array('key' => $defaultOptions['key'], 'html5player' => $defaultOptions['html5player'], 'flashplayer' => $defaultOptions['flashplayer'], 'type' => $media->getType(), 'id' => uniqid('thrace_media', true), 'file' => $this->container->get('router')->generate('thrace_media_render', array('name' => $media->getMediaPath(), 'hash' => $media->getHash()), true));
     $configs = array_replace_recursive($configs, $options);
     return $this->container->get('templating')->render('ThraceMediaBundle:Media:media.html.twig', array('media' => $media, 'configs' => $configs));
 }
开发者ID:thrace-project,项目名称:media-bundle,代码行数:15,代码来源:MediaExtension.php

示例3: param

 public function param($key)
 {
     if ($this->container->hasParameter($key)) {
         return $this->container->getParameter($key);
     }
     throw new Exception("Brak parametru w parameters.yml o nazwie '" . $key . "'");
 }
开发者ID:stopsopa,项目名称:utils,代码行数:7,代码来源:TwigExtensions.php

示例4: createTicket

 /**
  * @param Event $event
  * @param User  $user
  *
  * @return Ticket
  */
 public function createTicket($event, $user)
 {
     // @todo це ще треба передивитись і поправити
     $em = $this->container->get('doctrine.orm.default_entity_manager');
     // Вытягиваем скидку из конфига
     $paymentsConfig = $this->container->getParameter('stfalcon_event.config');
     $discount = (double) $paymentsConfig['discount'];
     $ticket = new Ticket();
     $ticket->setEvent($event);
     $ticket->setUser($user);
     $ticket->setAmountWithoutDiscount($event->getCost());
     $paidPayments = $em->getRepository('StfalconEventBundle:Payment')->findPaidPaymentsForUser($user);
     // если пользователь имеет оплаченные события,
     // то он получает скидку (если для события разрешена такая скидка)
     if (count($paidPayments) > 0 && $event->getUseDiscounts()) {
         $cost = $event->getCost() - $event->getCost() * $discount;
         $hasDiscount = true;
     } else {
         $cost = $event->getCost();
         $hasDiscount = false;
     }
     $ticket->setAmount($cost);
     $ticket->setHasDiscount($hasDiscount);
     $em->persist($ticket);
     $em->flush();
     return $ticket;
 }
开发者ID:bolotyuh,项目名称:fwdays,代码行数:33,代码来源:TicketService.php

示例5: dump

 public function dump(AssetInterface $asset)
 {
     $writer = new \Assetic\AssetWriter(sys_get_temp_dir(), $this->container->getParameter('assetic.variables'));
     $ref = new \ReflectionMethod($writer, 'getCombinations');
     $ref->setAccessible(true);
     $name = $asset->getSourcePath();
     $type = substr($name, strrpos($name, '.') + 1);
     switch ($type) {
         case 'coffee':
             $asset->ensureFilter($this->container->get('assetic.filter.coffee'));
             $type = 'js';
             break;
         case 'less':
             $asset->ensureFilter($this->container->get('assetic.filter.less'));
             $type = 'css';
             break;
     }
     $combinations = $ref->invoke($writer, $asset->getVars());
     $asset->setValues($combinations[0]);
     $asset->load();
     $content = $asset->getContent();
     // because the assetic cssrewrite makes bullshit here, we need to reimplement the filter
     if ($type === 'css') {
         $content = $this->cssFilter($content, '/' . dirname($asset->getSourcePath()));
     }
     return $content;
 }
开发者ID:roomthirteen,项目名称:Room13AsseticServerBundle,代码行数:27,代码来源:DumpAssetCommand.php

示例6: authentifyAsSystem

 /**
  * Authentify as system
  *
  * @return Auth
  */
 public function authentifyAsSystem()
 {
     $this->login = $this->container->getParameter('fidesio_isidore.client.login');
     $this->password = $this->container->getParameter('fidesio_isidore.client.password');
     $this->authentify($this->login, $this->password);
     return $this;
 }
开发者ID:fidesio,项目名称:isidore-bundle,代码行数:12,代码来源:Auth.php

示例7: warmUp

 public function warmUp($cacheDir)
 {
     // we need the directory no matter the hydrator cache generation strategy.
     $hydratorCacheDir = $this->container->getParameter('doctrine.odm.mongodb.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 writeable 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.odm.mongodb.auto_generate_hydrator_classes') === true) {
         return;
     }
     $documentManagers = $this->container->getParameter('doctrine.odm.mongodb.document_managers');
     foreach ($documentManagers as $documentManagerName) {
         $dm = $this->container->get(sprintf('doctrine.odm.mongodb.%s_document_manager', $documentManagerName));
         /* @var $dm Doctrine\ODM\MongoDB\DocumentManager */
         $classes = $dm->getMetadataFactory()->getAllMetadata();
         $dm->getHydratorFactory()->generateHydratorClasses($classes);
     }
 }
开发者ID:noelg,项目名称:symfony-demo,代码行数:25,代码来源:HydratorCacheWarmer.php

示例8: getTemplates

 /**
  * Template Loader
  *
  * @return Twig_TemplateInterface[]
  *
  * @throws \Exception
  */
 protected function getTemplates()
 {
     if (empty($this->templates)) {
         $this->templates[] = $this->environment->loadTemplate($this->container->getParameter('pedro_teixeira_grid.template'));
     }
     return $this->templates;
 }
开发者ID:isklv,项目名称:grid-bundle,代码行数:14,代码来源:GridExtension.php

示例9: createProvider

 public static function createProvider(Container $container)
 {
     $annotationsEnabled = $container->getParameter('rezonant.mapper.providers.annotations.enabled');
     $configEnabled = $container->getParameter('rezonant.mapper.providers.config.enabled');
     $cacheEnabled = $container->getParameter('rezonant.mapper.cache.enabled');
     $cacheStrategy = $container->getParameter('rezonant.mapper.cache.strategy');
     //$maps = $container->getParameter('rezonant.mapper.maps');
     $providers = array();
     if ($annotationsEnabled) {
         $providers[] = $container->get('rezonant.mapper.annotation_map_provider');
     }
     if ($configEnabled) {
         $configMapProvider = $container->get('rezonant.mapper.config_map_provider');
         //$configMapProvider->setMaps($maps);
         $providers[] = $configMapProvider;
     }
     $provider = new MapProviderModerator($providers);
     if ($cacheEnabled) {
         if (!class_exists($cacheStrategy, true)) {
             throw new InvalidConfigurationException("No such strategy class {$cacheStrategy}");
         }
         $provider = new CacheProvider($provider, new $cacheStrategy());
     }
     return $provider;
 }
开发者ID:Luwdo,项目名称:RezonantMapperBundle,代码行数:25,代码来源:ConfiguredMapProviderFactory.php

示例10: getRecaptchaSecureToken

 /**
  * Get a secure token for reCAPTCHA so we aren't restricted to a specific domain...
  * @see https://developers.google.com/recaptcha/docs/secure_token
  *
  * @return string
  */
 public function getRecaptchaSecureToken()
 {
     $public_key = $this->container->getParameter('recaptcha.public_key');
     $private_key = $this->container->getParameter('recaptcha.private_key');
     $recaptchaToken = new ReCaptchaToken(array('site_key' => $public_key, 'site_secret' => $private_key));
     return $recaptchaToken->secureToken(uniqid('recaptcha'));
 }
开发者ID:nateevans,项目名称:defrauder,代码行数:13,代码来源:TransactionType.php

示例11: postTweet

 private function postTweet($text)
 {
     Codebird::setConsumerKey($this->container->getParameter('twitter_consumer_key'), $this->container->getParameter('twitter_consumer_secret'));
     $cb = Codebird::getInstance();
     $cb->setToken($this->container->getParameter('twitter_access_token'), $this->container->getParameter('twitter_access_token_secret'));
     $reply = $cb->statuses_update('status=' . $text);
     return $reply;
 }
开发者ID:MrMitch,项目名称:Les-Joies-de-Supinfo,代码行数:8,代码来源:TwitterService.php

示例12: render

 public function render($type = 'search', $entities = null, $fields = null)
 {
     if ($this->templateEngine === null) {
         $this->templateEngine = $this->container->get('templating');
     }
     $template = $this->container->getParameter('enhavo_search.' . $type . '.template');
     return $this->templateEngine->render($template, array('type' => $type, 'entities' => $entities, 'fields' => $fields));
 }
开发者ID:enhavo,项目名称:enhavo,代码行数:8,代码来源:SearchForm.php

示例13: __construct

 public function __construct(Container $container, $soapUrl)
 {
     $this->talonClientSOAP = $container->get('be_simple_talon.soap_client.talon_soap_client');
     $this->setSoapUrl($soapUrl);
     $this->talonClientSOAP->setWsdl($this->getSoapUrl() . self::WSDL_PATH);
     $this->talonClientSOAP->setOptions(array("login" => $container->getParameter('http_auth_login'), "password" => $container->getParameter('http_auth_password'), "httpauth" => $container->getParameter('http_auth'), "verifyhost" => $container->getParameter('verifyhost')));
     $this->talonClientSOAP->TalonSoapClient();
 }
开发者ID:adminmapsoft,项目名称:timetable,代码行数:8,代码来源:MedCouponServiceTransportApiConsole.php

示例14: setUp

 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     static::bootKernel();
     $this->container = static::$kernel->getContainer();
     $this->baseUrl = $this->container->getParameter('mink.base_url');
     $this->session = $this->getMink()->getSession();
     $this->session->maximizeWindow();
 }
开发者ID:ruslan-polutsygan,项目名称:dev-bundle,代码行数:11,代码来源:TestCase.php

示例15: __construct

 /**
  * Constructor
  *
  * @param Container $container
  */
 public function __construct(Container $container)
 {
     $this->request = $container->get('request');
     $this->kernel = $container->get('kernel');
     $this->doctrine = $container->get('doctrine');
     $this->sessionData = array();
     $this->config = array('sessionDuration' => $container->getParameter('tga_audience.session_duration'), 'disabledRoutes' => $container->getParameter('tga_audience.disabled_routes'), 'environnements' => $container->getParameter('tga_audience.environnements'));
 }
开发者ID:tiitoo,项目名称:tga,代码行数:13,代码来源:KernelListener.php


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