當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ParameterBag::get方法代碼示例

本文整理匯總了PHP中Symfony\Component\HttpFoundation\ParameterBag::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP ParameterBag::get方法的具體用法?PHP ParameterBag::get怎麽用?PHP ParameterBag::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\HttpFoundation\ParameterBag的用法示例。


在下文中一共展示了ParameterBag::get方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: it_should_change_controller_attribute_to_use_service

 /**
  * @test
  */
 public function it_should_change_controller_attribute_to_use_service()
 {
     $this->attributes->set('_controller', 'stdClass::method');
     $this->given_controller_is_annotated_by_injectable_annotation();
     $this->listener->onKernelController($this->getEvent());
     $this->assertEquals('stdClass:method', $this->attributes->get('_controller'));
 }
開發者ID:tomaszhanc,項目名稱:php-di-symfony-bundle,代碼行數:10,代碼來源:ControllerListenerTest.php

示例2: update

 private function update(Note $note, ParameterBag $parameters)
 {
     $note->setTitle($parameters->get('title'));
     $note->setColor($parameters->get('color'));
     $note->setContent($parameters->get('content'));
     return $note;
 }
開發者ID:devs-workshops,項目名稱:keep,代碼行數:7,代碼來源:NoteRepository.php

示例3: update

 /**
  * @param ParameterBag $params
  *
  * @return boolean
  */
 public function update($params)
 {
     $entity = $this->rGet($params->get('id'));
     $entity->setName($params->get('name'));
     $entity->setGeneral($params->get('general'));
     $this->merge($entity);
 }
開發者ID:rsmakota,項目名稱:ortofit_backoffice,代碼行數:12,代碼來源:FamilyStatusManager.php

示例4: checkCopyAddress

 /**
  * Copies billing address to shipping address
  *
  * @param ParameterBag $parameters
  */
 protected function checkCopyAddress(ParameterBag $parameters)
 {
     if (1 === (int) $parameters->get('copyAddress')) {
         $billingAddress = $parameters->get('billingAddress');
         $parameters->set('shippingAddress', ['shippingAddress.firstName' => $billingAddress['billingAddress.firstName'], 'shippingAddress.lastName' => $billingAddress['billingAddress.lastName'], 'shippingAddress.street' => $billingAddress['billingAddress.street'], 'shippingAddress.streetNo' => $billingAddress['billingAddress.streetNo'], 'shippingAddress.flatNo' => $billingAddress['billingAddress.flatNo'], 'shippingAddress.city' => $billingAddress['billingAddress.city'], 'shippingAddress.postCode' => $billingAddress['billingAddress.postCode'], 'shippingAddress.country' => $billingAddress['billingAddress.country']]);
     }
 }
開發者ID:Sywooch,項目名稱:WellCommerce,代碼行數:12,代碼來源:AddressController.php

示例5: handle

 /**
  * @param Request $request
  * @param int     $type
  * @param bool    $catch
  *
  * @return Response
  * @throws \Exception
  */
 public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
 {
     if ($type === HttpKernelInterface::SUB_REQUEST) {
         return $this->app->handle($request, $type, $catch);
     }
     $parameters = $this->config->get('cookie_parameters');
     if (!isset($parameters[$this->config->get('current_locale')])) {
         throw new \Exception(sprintf('Domain %s not available', $this->config->get('current_locale')));
     }
     $cookieParams = $parameters[$this->config->get('current_locale')];
     $this->config->set('current_cookie_domain', $cookieParams['domain']);
     if (HttpKernelInterface::MASTER_REQUEST !== $type) {
         return $this->app->handle($request, $type, $catch);
     }
     $session = new Session();
     $request->setSession($session);
     $cookies = $request->cookies;
     if ($cookies->has($session->getName())) {
         $session->setId($cookies->get($session->getName()));
     } else {
         //starts the session if no session exists
         $session->start();
         $session->migrate(false);
     }
     $session->start();
     $response = $this->app->handle($request, $type, $catch);
     if ($session && $session->isStarted()) {
         $session->save();
         $params = array_merge(session_get_cookie_params(), $cookieParams);
         $cookie = new Cookie($session->getName(), $session->getId(), 0 === $params['lifetime'] ? 0 : $request->server->get('REQUEST_TIME') + $params['lifetime'], $params['path'], $params['domain'], $params['secure'], $params['httponly']);
         $response->headers->setCookie($cookie);
     }
     return $response;
 }
開發者ID:evaneos,項目名稱:pyrite,代碼行數:42,代碼來源:SessionMiddleware.php

示例6: testUpdateResponsePage

 public function testUpdateResponsePage()
 {
     $this->page->getCacheLifeTime()->willReturn('300');
     $this->page->getUuid()->willReturn('1234');
     $this->handler->updateResponse($this->response->reveal(), $this->page->reveal());
     $this->assertEquals('300', $this->parameterBag->get(DebugHandler::HEADER_STRUCTURE_TTL));
 }
開發者ID:Silwereth,項目名稱:sulu,代碼行數:7,代碼來源:DebugHandlerTest.php

示例7: update

 /**
  * @param ParameterBag $params
  *
  * @return boolean
  */
 public function update($params)
 {
     /** @var ClientDirection $entity */
     $entity = $this->rGet($params->get('id'));
     $entity->setName($params->get('name'));
     $this->merge($entity);
 }
開發者ID:rsmakota,項目名稱:ortofit_backoffice,代碼行數:12,代碼來源:ClientDirectionManager.php

示例8: buildTopNavMenu

 private final function buildTopNavMenu(ParameterBag $parameterBag)
 {
     static $tabDataContent = null;
     if (null === $tabDataContent) {
         $yamlParser = new Parser();
         $yamlNavigationPath = __DIR__ . '/../Resources/config/admin/navigation.yml';
         $tabConfiguration = $yamlParser->parse(file_get_contents($yamlNavigationPath));
         $explodedControllerInfo = explode('::', $parameterBag->get('_controller'));
         $explodedControllerName = explode('\\', $explodedControllerInfo[0]);
         $controllerNameIndex = count($explodedControllerName) - 1;
         $controllerName = $explodedControllerName[$controllerNameIndex];
         if (isset($tabConfiguration[$controllerName])) {
             // Construct tabs and inject into twig tpl
             $tabDataContent = array();
             // Get current route name to know when to put "current" class on HTML dom
             $currentRouteName = $parameterBag->get('_route');
             foreach ($tabConfiguration[$controllerName] as $tabName => $tabData) {
                 $tabData['isCurrent'] = false;
                 if ($currentRouteName === $tabData['route']) {
                     $tabData['isCurrent'] = true;
                 }
                 $tabDataContent[] = $this->environment->render('PrestaShopBundle:Admin/Common/_partials:_header_tab.html.twig', array('tabData' => $tabData));
             }
             // Inject them to templating system as global to be able to pass it to the legacy afterwards and once
             // controller has given a response
         }
     }
     return $tabDataContent;
 }
開發者ID:M03G,項目名稱:PrestaShop,代碼行數:29,代碼來源:AdminExtension.php

示例9: update

 /**
  * @param ParameterBag $params
  *
  * @return boolean
  */
 public function update($params)
 {
     /** @var Office $entity */
     $entity = $this->rGet($params->get('id'));
     $entity->setCity($params->get('city'));
     $entity->setName($params->get('name'));
     $this->merge($entity);
 }
開發者ID:rsmakota,項目名稱:ortofit_backoffice,代碼行數:13,代碼來源:OfficeManager.php

示例10: createColumnMapping

 protected function createColumnMapping(ParameterBag $query)
 {
     $mapping = [];
     for ($i = 0; $i < $query->get('iColumns'); $i++) {
         $mapping[$i] = $query->get("mDataProp_{$i}");
     }
     return $mapping;
 }
開發者ID:deft,項目名稱:datatables-php,代碼行數:8,代碼來源:RequestParser.php

示例11: testSet

 /**
  * @covers Symfony\Component\HttpFoundation\ParameterBag::set
  */
 public function testSet()
 {
     $bag = new ParameterBag(array());
     $bag->set('foo', 'bar');
     $this->assertEquals('bar', $bag->get('foo'), '->set() sets the value of parameter');
     $bag->set('foo', 'baz');
     $this->assertEquals('baz', $bag->get('foo'), '->set() overrides previously set parameter');
 }
開發者ID:renegare,項目名稱:symfony,代碼行數:11,代碼來源:ParameterBagTest.php

示例12: update

 /**
  * @param ParameterBag $params
  *
  * @return boolean
  */
 public function update($params)
 {
     /** @var Diagnosis $entity */
     $entity = $this->rGet($params->get('id'));
     $entity->setDescription($params->get('description'));
     $entity->setPerson($params->get('person'));
     $this->merge($entity);
 }
開發者ID:rsmakota,項目名稱:ortofit_backoffice,代碼行數:13,代碼來源:DiagnosisManager.php

示例13: MyService

 function it_calls_the_service_with_configured_arguments(ContainerInterface $container, Request $request, ParameterBag $attributes)
 {
     $container->get('my_service')->willReturn(new MyService());
     $configuration = new ParamConverter(['name' => 'foo', 'class' => MyArgument::class, 'options' => ['service' => 'my_service', 'method' => 'myMethod', 'arguments' => ['id', 'name']]]);
     $attributes->get('id')->willReturn(42);
     $attributes->get('name')->willReturn('Bob');
     $attributes->set('foo', new MyArgument(42, 'Bob'))->shouldBeCalled();
     $this->apply($request, $configuration);
 }
開發者ID:jakzal,項目名稱:ParamConverterBundle,代碼行數:9,代碼來源:ServiceParamConverterSpec.php

示例14:

 function it_throws_an_exception_if_no_repository_can_be_found($doctrine, Request $request, ParameterBag $query, \stdClass $repository)
 {
     $request->query = $query;
     $query->get('search')->willReturn('hello');
     $query->get('referenceDataName')->willReturn(null);
     $query->get('class')->willReturn('Foo\\Bar');
     $doctrine->getRepository('Foo\\Bar')->willReturn($repository);
     $this->shouldThrow(new \LogicException('The repository of the class "Foo\\Bar" can not retrieve options via Ajax.'))->during('listAction', [$request]);
 }
開發者ID:a2xchip,項目名稱:pim-community-dev,代碼行數:9,代碼來源:AjaxOptionControllerSpec.php

示例15: update

 /**
  * @param ParameterBag $params
  *
  * @return boolean
  */
 public function update($params)
 {
     $application = $this->rGet($params->get('applicationId'));
     $client = $this->rGet($params->get('clientId'));
     $entity = $this->rGet($params->get('id'));
     $entity->setApplication($application);
     $entity->setClient($client);
     $this->merge($entity);
 }
開發者ID:rsmakota,項目名稱:ortofit_backoffice,代碼行數:14,代碼來源:OrderManager.php


注:本文中的Symfony\Component\HttpFoundation\ParameterBag::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。