本文整理匯總了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);
}
示例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);
}