當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。