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