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


PHP HttpFoundation\ParameterBag类代码示例

本文整理汇总了PHP中Symfony\Component\HttpFoundation\ParameterBag的典型用法代码示例。如果您正苦于以下问题:PHP ParameterBag类的具体用法?PHP ParameterBag怎么用?PHP ParameterBag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: let

 public function let(ParameterBag $attributes, Request $request, GetResponseEvent $event, ParameterStack $stack)
 {
     $event->getRequest()->willReturn($request);
     $request->attributes = $attributes;
     $attributes->get('_route_params', Argument::any())->willReturn(['foo' => 'bar', 'baz' => 2]);
     $this->beConstructedWith($stack);
 }
开发者ID:knplabs,项目名称:rad-url-generation,代码行数:7,代码来源:ParameterExtractionListenerSpec.php

示例2: Response

 /**
  * @param \FSi\Bundle\AdminBundle\Admin\Context\Request\HandlerInterface $handler
  * @param \Symfony\Component\HttpFoundation\Request $request
  * @param \Symfony\Component\HttpFoundation\ParameterBag $requestParameterBag
  */
 function it_return_response_from_handler($handler, $request, $requestParameterBag)
 {
     $handler->handleRequest(Argument::type('FSi\\Bundle\\AdminBundle\\Event\\FormEvent'), $request)->willReturn(new Response());
     $request->request = $requestParameterBag;
     $requestParameterBag->get('indexes', array())->willReturn(array());
     $this->handleRequest($request)->shouldReturnAnInstanceOf('Symfony\\Component\\HttpFoundation\\Response');
 }
开发者ID:kbedn,项目名称:admin-bundle,代码行数:12,代码来源:BatchElementContextSpec.php

示例3: configureActionsVars

 public function configureActionsVars(ParameterBag $actionsVars)
 {
     if ($this->container->isScopeActive('request')) {
         $adminSession = new AdminSession($this->container->get('request'), $this->container->get('session'), $this->getOption('sessionParameter'));
         $actionsVars->set('admin_session', $adminSession);
     }
 }
开发者ID:hostingnuggets,项目名称:WhiteOctoberAdminBundle,代码行数:7,代码来源:ListAction.php

示例4: 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

示例5: let

 public function let(ActionFactory $actionFactory, ActionEventManager $eventManager, ManagerRegistry $managerRegistry, ManagerInterface $manager, RouterInterface $router, TranslatorInterface $translator, MassActionDispatcher $massActionDispatcher, JobInstanceRepository $jobInstanceRepository, JobLauncherInterface $jobLauncher, TokenStorageInterface $tokenStorage, Request $request, ParameterBag $attributes, ConfigurationInterface $configuration, Session $session, FlashBag $flashBag)
 {
     $this->beConstructedWith($actionFactory, $eventManager, $managerRegistry, $router, $translator, $massActionDispatcher, $jobInstanceRepository, $jobLauncher, $tokenStorage);
     // initialize configuration
     $configuration->getEntityClass()->willReturn('entity_class');
     $configuration->getName()->willReturn('entity');
     // initialize manager
     $managerRegistry->getFromConfiguration($configuration)->willReturn($manager);
     // initialize router
     $router->generate(Argument::type('string'), Argument::type('array'), Argument::any())->will(function ($arguments) {
         $path = $arguments[0] . '?';
         foreach ($arguments[1] as $key => $value) {
             $path .= '&' . $key . '=' . $value;
         }
         return $path;
     });
     // initialize request
     $request->attributes = $attributes;
     $attributes->get('id')->willReturn('id');
     // initialize flashbag
     $request->getSession()->willReturn($session);
     $session->getFlashBag()->willReturn($flashBag);
     // initialize translator
     $translator->trans(Argument::type('string'), Argument::any())->will(function ($arguments) {
         if (!isset($arguments[1])) {
             $arguments[1] = array();
         }
         $translated = sprintf('<%s>', $arguments[0]);
         foreach ($arguments[1] as $key => $value) {
             $translated .= sprintf('%s=%s;', $key, $value);
         }
         return $translated;
     });
 }
开发者ID:ronanguilloux,项目名称:CustomEntityBundle,代码行数:34,代码来源:QuickExportActionSpec.php

示例6: let

 public function let(ActionFactory $actionFactory, ActionEventManager $eventManager, ManagerRegistry $managerRegistry, ManagerInterface $manager, RouterInterface $router, TranslatorInterface $translator, ConfigurationInterface $configuration, Request $request, ParameterBag $attributes, EngineInterface $templating, FormFactoryInterface $formFactory, FormInterface $form, FormView $formView, Entity $object, ActionInterface $indexAction)
 {
     $this->beConstructedWith($actionFactory, $eventManager, $managerRegistry, $router, $translator, $templating, $formFactory);
     // initialize configuration
     $configuration->getEntityClass()->willReturn('entity_class');
     $configuration->getName()->willReturn('entity');
     // initialize manager
     $managerRegistry->getFromConfiguration($configuration)->willReturn($manager);
     // initialize router
     $router->generate(Argument::type('string'), Argument::type('array'), Argument::any())->will(function ($arguments) {
         $path = $arguments[0] . '?';
         foreach ($arguments[1] as $key => $value) {
             $path .= '&' . $key . '=' . $value;
         }
         return $path;
     });
     // initialize form
     $formFactory->create('form_type', $object, ['data_class' => 'entity_class'])->willReturn($form);
     $form->createView()->willReturn($formView);
     $form->getData()->willReturn($object);
     // initialize request
     $request->attributes = $attributes;
     $attributes->get('id')->willReturn('id');
     // initialize configuration for form
     $actionFactory->getAction('entity', 'index')->willReturn($indexAction);
     $configuration->hasAction('index')->willReturn(true);
     $indexAction->getRoute()->willReturn('index');
     $indexAction->getRouteParameters(null)->willReturn(['ir_param1' => 'value1']);
 }
开发者ID:ronanguilloux,项目名称:CustomEntityBundle,代码行数:29,代码来源:EditActionSpec.php

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: generateDiscountCode

 public function generateDiscountCode(ParameterBag $options)
 {
     $length = $options->get('length');
     if (0 > $length || self::MAX_LENGTH < $length) {
         throw new InvalidArgumentException("Wrong number of codes");
     }
     return $this->engine->getCode($length);
 }
开发者ID:purplefan,项目名称:dcodes,代码行数:8,代码来源:CodeGenerator.php

示例12:

 function it_returns_null_channel_code_if_no_fake_channel_code_was_found(Request $request, ParameterBag $queryBag, ParameterBag $cookiesBag)
 {
     $queryBag->get('_channel_code')->willReturn(null);
     $request->query = $queryBag;
     $cookiesBag->get('_channel_code')->willReturn(null);
     $request->cookies = $cookiesBag;
     $this->getCode($request)->shouldReturn(null);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:8,代码来源:FakeChannelCodeProviderSpec.php

示例13: it_do_not_authenticate_channel_when_cookie_name_is_missing

 public function it_do_not_authenticate_channel_when_cookie_name_is_missing(Session $session, ParameterBag $cookies)
 {
     $session->getName()->shouldBeCalled()->willReturn('session');
     $cookies->get('session')->shouldBeCalled()->willReturn('invalid_channel');
     $session->set('socketId', 1)->shouldNotBeCalled();
     $session->set('channelName', 'new_channel')->shouldNotBeCalled();
     $this->authenticate(1, 'new_channel')->shouldReturn(false);
 }
开发者ID:pazjacket,项目名称:pborreli-_-composer-service,代码行数:8,代码来源:ChannelAuthenticatorSpec.php

示例14:

 function it_sets_request($localeSettings, Request $request, ParameterBag $parameterBag)
 {
     $parameterBag->get('_locale')->willReturn(true);
     $request->attributes = $parameterBag;
     $localeSettings->getLanguage()->shouldNotBeCalled();
     $localeSettings->getLocale()->willReturn('fr_FR');
     $this->setRequest($request);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:8,代码来源:LocalSubscriberSpec.php

示例15:

 function it_checks_if_an_item_is_in_the_includes(Request $request, ParameterBag $parameterBag)
 {
     $includes = 'product,image';
     $entity = 'image';
     $request->query = $parameterBag;
     $parameterBag->get('include')->shouldBeCalledTimes(1)->willReturn($includes);
     $this->inIncludes($entity)->shouldReturn(true);
 }
开发者ID:larapackage,项目名称:api,代码行数:8,代码来源:ParserSpec.php


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