本文整理汇总了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);
}
示例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;
}
示例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);
}
示例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);
}
示例5: let
function let(RepositoryInterface $repository)
{
$repository->getClassName()->willReturn('spec\\Sylius\\Bundle\\ResourceBundle\\Form\\DataTransformer\\FakeEntity');
$this->beConstructedWith($repository, 'id');
}
示例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'])]]);
}
示例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']])]]);
}