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


PHP MetadataInterface::getPluralName方法代碼示例

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


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

示例1: indexAction

 /**
  * @param Request $request
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function indexAction(Request $request)
 {
     $configuration = $this->requestConfigurationFactory->create($this->metadata, $request);
     $this->isGrantedOr403($configuration, ResourceActions::INDEX);
     $resources = $this->resourcesCollectionProvider->get($configuration, $this->repository);
     $view = View::create($resources);
     if ($configuration->isHtmlRequest()) {
         $view->setTemplate($configuration->getTemplate(ResourceActions::INDEX . '.html'))->setTemplateVar($this->metadata->getPluralName())->setData(['configuration' => $configuration, 'metadata' => $this->metadata, 'resources' => $resources, $this->metadata->getPluralName() => $resources]);
     }
     return $this->viewHandler->handle($configuration, $view);
 }
開發者ID:sylius,項目名稱:sylius,代碼行數:16,代碼來源:ResourceController.php

示例2: array

 function it_returns_a_response_for_html_view_of_paginated_resources(MetadataInterface $metadata, RequestConfigurationFactoryInterface $requestConfigurationFactory, RequestConfiguration $configuration, AuthorizationCheckerInterface $authorizationChecker, RepositoryInterface $repository, ResourcesCollectionProviderInterface $resourcesCollectionProvider, ResourceInterface $resource1, ResourceInterface $resource2, ViewHandlerInterface $viewHandler, Request $request, Response $response)
 {
     $metadata->getApplicationName()->willReturn('sylius');
     $metadata->getName()->willReturn('product');
     $metadata->getPluralName()->willReturn('products');
     $requestConfigurationFactory->create($metadata, $request)->willReturn($configuration);
     $configuration->hasPermission()->willReturn(true);
     $configuration->getPermission(ResourceActions::INDEX)->willReturn('sylius.product.index');
     $authorizationChecker->isGranted($configuration, 'sylius.product.index')->willReturn(true);
     $configuration->isHtmlRequest()->willReturn(true);
     $configuration->getTemplate(ResourceActions::INDEX)->willReturn('SyliusShopBundle:Product:index.html.twig');
     $resourcesCollectionProvider->get($configuration, $repository)->willReturn(array($resource1, $resource2));
     $expectedView = View::create()->setData(array('metadata' => $metadata, 'resources' => array($resource1, $resource2), 'products' => array($resource1, $resource2)))->setTemplateVar('products')->setTemplate('SyliusShopBundle:Product:index.html.twig');
     $viewHandler->handle($configuration, Argument::that($this->getViewComparingCallback($expectedView)))->willReturn($response);
     $this->indexAction($request)->shouldReturn($response);
 }
開發者ID:Spomky,項目名稱:Sylius,代碼行數:16,代碼來源:ResourceControllerSpec.php


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