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


PHP MetadataInterface::getHumanizedName方法代碼示例

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


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

示例1:

 function it_adds_custom_message(SessionInterface $session, TranslatorBagInterface $translator, MessageCatalogueInterface $messageCatalogue, FlashBagInterface $flashBag, MetadataInterface $metadata, RequestConfiguration $requestConfiguration, ResourceInterface $resource)
 {
     $metadata->getApplicationName()->willReturn('app');
     $metadata->getHumanizedName()->willReturn('book');
     $requestConfiguration->getMetadata()->willReturn($metadata);
     $requestConfiguration->getFlashMessage('send')->willReturn('app.book.send');
     $translator->getCatalogue('en')->willReturn($messageCatalogue);
     $messageCatalogue->has('app.book.send', 'flashes')->willReturn(true);
     $session->getBag('flashes')->willReturn($flashBag);
     $flashBag->add('success', 'app.book.send')->shouldBeCalled();
     $this->addSuccessFlash($requestConfiguration, 'send', $resource);
 }
開發者ID:loic425,項目名稱:Sylius,代碼行數:12,代碼來源:FlashHelperSpec.php

示例2:

 function it_uses_default_translation_if_message_is_not_translated(SessionInterface $session, FlashBagInterface $flashBag, TranslatorInterface $translator, MetadataInterface $metadata, RequestConfiguration $requestConfiguration, ResourceInterface $resource)
 {
     $metadata->getApplicationName()->willReturn('sylius');
     $metadata->getName()->willReturn('product');
     $metadata->getHumanizedName()->willReturn('product');
     $requestConfiguration->getMetadata()->willReturn($metadata);
     $requestConfiguration->isHtmlRequest()->willReturn(true);
     $session->getBag('flashes')->willReturn($flashBag);
     $requestConfiguration->getFlashMessage(ResourceActions::CREATE)->willReturn('sylius.product.create');
     $translator->trans('sylius.product.create', ['%resource%' => 'Product'], 'flashes')->willReturn('sylius.product.create');
     $translator->trans('sylius.resource.create', ['%resource%' => 'Product'], 'flashes')->willReturn('Product has been successfully created.');
     $flashBag->add('success', 'Product has been successfully created.')->shouldBeCalled();
     $this->addSuccessFlash($requestConfiguration, ResourceActions::CREATE, $resource);
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:14,代碼來源:FlashHelperSpec.php

示例3: translateMessage

 /**
  * @param string $flashMessage
  * @param MetadataInterface $metadata
  *
  * @return string
  */
 private function translateMessage($flashMessage, MetadataInterface $metadata)
 {
     return $this->translator->trans($flashMessage, ['%resource%' => ucfirst($metadata->getHumanizedName())], 'flashes');
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:10,代碼來源:FlashHelper.php

示例4: getPermissionRole

 protected function getPermissionRole($type, MetadataInterface $metadata)
 {
     return strtoupper(sprintf('ROLE_%s_%s_%s', $metadata->getApplicationName(), $metadata->getHumanizedName(), $type));
 }
開發者ID:npakai,項目名稱:enhavo,代碼行數:4,代碼來源:ResourceController.php

示例5: getUnderscoreName

 protected function getUnderscoreName()
 {
     $name = $this->metadata->getHumanizedName();
     $name = str_replace(' ', '_', $name);
     return $name;
 }
開發者ID:enhavo,項目名稱:enhavo,代碼行數:6,代碼來源:AbstractViewer.php


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