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


PHP RepositoryInterface::getClassName方法代碼示例

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


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

示例1: reverseTransform

 /**
  * {@inheritdoc}
  */
 public function reverseTransform($value)
 {
     if (null === $value) {
         return null;
     }
     $class = $this->repository->getClassName();
     Assert::isInstanceOf($value, $class);
     $accessor = PropertyAccess::createPropertyAccessor();
     return $accessor->getValue($value, $this->identifier);
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:13,代碼來源:IdentifierToResourceTransformer.php

示例2: reverseTransform

 /**
  * {@inheritdoc}
  */
 public function reverseTransform($value)
 {
     if (null === $value) {
         return null;
     }
     $resource = $this->repository->findOneBy([$this->identifier => $value]);
     if (null === $resource) {
         throw new TransformationFailedException(sprintf('Object "%s" with identifier "%s"="%s" does not exist.', $this->repository->getClassName(), $this->identifier, $value));
     }
     return $resource;
 }
開發者ID:NeverResponse,項目名稱:Sylius,代碼行數:14,代碼來源:ResourceToIdentifierTransformer.php

示例3:

 function it_reverse_transform_resource_to_identifier(RepositoryInterface $repository, FakeEntity $value)
 {
     $repository->getClassName()->willReturn(FakeEntity::class);
     $value->getId()->willReturn(6);
     $this->reverseTransform($value)->shouldReturn(6);
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:6,代碼來源:IdentifierToResourceTransformerSpec.php

示例4:

 function it_transforms_resource_in_identifier(RepositoryInterface $repository, ResourceInterface $resource)
 {
     $repository->getClassName()->willReturn(ResourceInterface::class);
     $resource->getId()->willReturn(6);
     $this->transform($resource)->shouldReturn(6);
 }
開發者ID:NeverResponse,項目名稱:Sylius,代碼行數:6,代碼來源:ResourceToIdentifierTransformerSpec.php

示例5: let

 function let(RepositoryInterface $repository)
 {
     $repository->getClassName()->willReturn('spec\\Sylius\\Bundle\\ResourceBundle\\Form\\DataTransformer\\FakeEntity');
     $this->beConstructedWith($repository, 'id');
 }
開發者ID:gabiudrescu,項目名稱:Sylius,代碼行數:5,代碼來源:ResourceToIdentifierTransformerSpec.php

示例6: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('groups', 'sylius_group_from_identifier', ['label' => 'sylius.form.action.customer_group', 'property' => 'name', 'class' => $this->groupRepository->getClassName(), 'constraints' => [new NotBlank(), new Type(['type' => 'numeric'])]]);
 }
開發者ID:gabiudrescu,項目名稱:Sylius,代碼行數:7,代碼來源:CustomerGroupType.php

示例7: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('group', CustomerGroupCodeChoiceType::class, ['label' => 'sylius.form.promotion_action.customer_group', 'property' => 'name', 'class' => $this->groupRepository->getClassName(), 'constraints' => [new NotBlank(['groups' => ['sylius']]), new Type(['type' => 'numeric', 'groups' => ['sylius']])]]);
 }
開發者ID:Niiko,項目名稱:Sylius,代碼行數:7,代碼來源:CustomerGroupType.php


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