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


PHP Controller\RequestConfiguration类代码示例

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


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

示例1:

 function it_creates_the_object_if_form_is_a_class_name(RequestConfiguration $requestConfiguration, ResourceInterface $resource, FormFactoryInterface $formFactory, FormInterface $form)
 {
     $requestConfiguration->isHtmlRequest()->willReturn(true);
     $requestConfiguration->getFormType()->willReturn(TextType::class);
     $formFactory->create(Argument::type(TextType::class), $resource)->willReturn($form);
     $this->create($requestConfiguration, $resource)->shouldReturn($form);
 }
开发者ID:Mangetsu,项目名称:Sylius,代码行数:7,代码来源:ResourceFormFactorySpec.php

示例2: create

 /**
  * {@inheritdoc}
  */
 public function create(Grid $grid, Parameters $parameters, MetadataInterface $metadata, RequestConfiguration $requestConfiguration)
 {
     $driverConfiguration = $grid->getDriverConfiguration();
     $request = $requestConfiguration->getRequest();
     $grid->setDriverConfiguration($this->parametersParser->parseRequestValues($driverConfiguration, $request));
     return new ResourceGridView($this->dataProvider->getData($grid, $parameters), $grid, $parameters, $metadata, $requestConfiguration);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:ResourceGridViewFactory.php

示例3:

 function it_uses_a_custom_method_if_configured(RequestConfiguration $requestConfiguration, RepositoryInterface $repository, ResourceInterface $resource)
 {
     $requestConfiguration->getRepositoryMethod()->willReturn('findAll');
     $requestConfiguration->getRepositoryArguments()->willReturn(array('foo'));
     $repository->findAll('foo')->willReturn($resource);
     $this->get($requestConfiguration, $repository)->shouldReturn($resource);
 }
开发者ID:Spomky,项目名称:Sylius,代码行数:7,代码来源:SingleResourceProviderSpec.php

示例4:

 function it_calls_proper_factory_methods_based_on_configuration(RequestConfiguration $requestConfiguration, FactoryInterface $factory)
 {
     $requestConfiguration->getFactoryMethod()->willReturn('createNew');
     $requestConfiguration->getFactoryArguments()->willReturn(['00032']);
     $factory->createNew('00032')->willReturn(['foo', 'bar']);
     $this->create($requestConfiguration, $factory)->shouldReturn(['foo', 'bar']);
 }
开发者ID:gabiudrescu,项目名称:Sylius,代码行数:7,代码来源:NewResourceFactorySpec.php

示例5: redirect

 /**
  * {@inheritdoc}
  */
 public function redirect(RequestConfiguration $configuration, $url, $status = 302)
 {
     if ($configuration->isHeaderRedirection()) {
         return new Response('', 200, ['X-SYLIUS-LOCATION' => $url . $configuration->getRedirectHash()]);
     }
     return new RedirectResponse($url . $configuration->getRedirectHash(), $status);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:RedirectHandler.php

示例6: apply

 /**
  * {@inheritdoc}
  */
 public function apply(RequestConfiguration $configuration, ResourceInterface $resource)
 {
     if (!$configuration->hasStateMachine()) {
         throw new \InvalidArgumentException('State machine must be configured to apply transition, check your routing.');
     }
     $this->stateMachineFactory->get($resource, $configuration->getStateMachineGraph())->apply($configuration->getStateMachineTransition());
 }
开发者ID:loic425,项目名称:Sylius,代码行数:10,代码来源:StateMachine.php

示例7: redirectToCartSummary

 /**
  * @param RequestConfiguration $configuration
  *
  * @return RedirectResponse
  */
 protected function redirectToCartSummary(RequestConfiguration $configuration)
 {
     if (null === $configuration->getParameters()->get('redirect')) {
         return $this->redirectHandler->redirectToRoute($configuration, $this->getCartSummaryRoute());
     }
     return $this->redirectHandler->redirectToRoute($configuration, $configuration->getParameters()->get('redirect'));
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:12,代码来源:Controller.php

示例8: isGranted

 /**
  * @param RequestConfiguration $requestConfiguration
  * @param string $permission
  *
  * @return bool
  */
 public function isGranted(RequestConfiguration $requestConfiguration, $permission)
 {
     if (!$requestConfiguration->hasPermission()) {
         return true;
     }
     return $this->rbacAuthorizationChecker->isGranted($permission);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:13,代码来源:RbacAuthorizationChecker.php

示例9: create

 /**
  * {@inheritdoc}
  */
 public function create(RequestConfiguration $requestConfiguration, FactoryInterface $factory)
 {
     if (null === ($method = $requestConfiguration->getFactoryMethod())) {
         return $factory->createNew();
     }
     $arguments = array_values($requestConfiguration->getFactoryArguments());
     return $factory->{$method}(...$arguments);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:11,代码来源:NewResourceFactory.php

示例10: redirectAfterAdd

 /**
  * Redirect to specific URL or to cart.
  *
  * @param Request $request
  *
  * @return RedirectResponse
  */
 private function redirectAfterAdd(RequestConfiguration $configuration)
 {
     $request = $configuration->getRequest();
     if ($request->query->has('_redirect_to')) {
         return $this->redirectHandler->redirect($configuration, $request->query->get('_redirect_to'));
     }
     return $this->redirectToCartSummary($configuration);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:15,代码来源:CartItemController.php

示例11: redirectToCartSummary

 protected function redirectToCartSummary(RequestConfiguration $configuration)
 {
     $format = $configuration->getRequest()->getRequestFormat('html');
     if (null === $configuration->getParameters()->get('redirect')) {
         return $this->getRedirectHandler()->redirectToRoute($configuration, $this->getCartSummaryRoute(), ['_format' => $format]);
     }
     return $this->getRedirectHandler()->redirectToRoute($configuration, $this->getCartSummaryRoute(), ['_format' => $format]);
 }
开发者ID:enhavo,项目名称:enhavo,代码行数:8,代码来源:CartSummaryTrait.php

示例12:

 function it_creates_form_without_root_name_and_disables_csrf_protection_for_non_html_requests(RequestConfiguration $requestConfiguration, ResourceInterface $resource, FormFactoryInterface $formFactory, FormInterface $form)
 {
     $requestConfiguration->isHtmlRequest()->willReturn(false);
     $requestConfiguration->getFormType()->willReturn('sylius_product_api');
     $requestConfiguration->getFormOptions()->willReturn([]);
     $formFactory->createNamed('', 'sylius_product_api', $resource, ['csrf_protection' => false])->willReturn($form);
     $this->create($requestConfiguration, $resource)->shouldReturn($form);
 }
开发者ID:sylius,项目名称:sylius,代码行数:8,代码来源:ResourceFormFactorySpec.php

示例13: dispatchPostEvent

 /**
  * {@inheritdoc}
  */
 public function dispatchPostEvent($eventName, RequestConfiguration $requestConfiguration, ResourceInterface $resource)
 {
     $eventName = $requestConfiguration->getEvent() ?: $eventName;
     $metadata = $requestConfiguration->getMetadata();
     $event = $this->getEvent($resource);
     $this->eventDispatcher->dispatch(sprintf('%s.%s.post_%s', $metadata->getApplicationName(), $metadata->getName(), $eventName), $event);
     return $event;
 }
开发者ID:loic425,项目名称:Sylius,代码行数:11,代码来源:EventDispatcher.php

示例14:

 function it_applies_configured_state_machine_transition(RequestConfiguration $requestConfiguration, ResourceInterface $resource, FactoryInterface $stateMachineFactory, StateMachineInterface $stateMachine)
 {
     $requestConfiguration->hasStateMachine()->willReturn(true);
     $requestConfiguration->getStateMachineGraph()->willReturn('sylius_product_review_state');
     $requestConfiguration->getStateMachineTransition()->willReturn('reject');
     $stateMachineFactory->get($resource, 'sylius_product_review_state')->willReturn($stateMachine);
     $stateMachine->apply('reject')->shouldBeCalled();
     $this->apply($requestConfiguration, $resource);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:9,代码来源:StateMachineSpec.php

示例15: create

 /**
  * {@inheritdoc}
  */
 public function create(RequestConfiguration $requestConfiguration, ResourceInterface $resource)
 {
     $formType = $requestConfiguration->getFormType();
     $formOptions = $requestConfiguration->getFormOptions();
     if ($requestConfiguration->isHtmlRequest()) {
         return $this->formFactory->create($formType, $resource, $formOptions);
     }
     return $this->formFactory->createNamed('', $formType, $resource, array_merge($formOptions, ['csrf_protection' => false]));
 }
开发者ID:sylius,项目名称:sylius,代码行数:12,代码来源:ResourceFormFactory.php


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