本文整理汇总了PHP中Symfony\Component\Validator\ExecutionContextInterface::getPropertyPath方法的典型用法代码示例。如果您正苦于以下问题:PHP ExecutionContextInterface::getPropertyPath方法的具体用法?PHP ExecutionContextInterface::getPropertyPath怎么用?PHP ExecutionContextInterface::getPropertyPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Validator\ExecutionContextInterface
的用法示例。
在下文中一共展示了ExecutionContextInterface::getPropertyPath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param mixed $subject
* @param ConstraintValidatorFactoryInterface $constraintValidatorFactory
* @param ExecutionContextInterface $context
* @param string $group
*/
public function __construct($subject, ConstraintValidatorFactoryInterface $constraintValidatorFactory, ExecutionContextInterface $context, $group)
{
$this->subject = $subject;
$this->context = $context;
$this->group = $group;
$this->constraintValidatorFactory = $constraintValidatorFactory;
$this->current = '';
$this->basePropertyPath = $this->context->getPropertyPath();
}
示例2: __construct
/**
* @param mixed $subject
* @param ConstraintValidatorFactoryInterface $constraintValidatorFactory
* @param LegacyExecutionContextInterface|ExecutionContextInterface $context
* @param string $group
*/
public function __construct($subject, ConstraintValidatorFactoryInterface $constraintValidatorFactory, $context, $group)
{
if (!$context instanceof LegacyExecutionContextInterface && !$context instanceof ExecutionContextInterface) {
throw new \InvalidArgumentException(sprintf('Argument 3 passed to %s::__construct() must be an instance of Symfony\\Component\\Validator\\ExecutionContextInterface or Symfony\\Component\\Validator\\Context\\ExecutionContextInterface.', get_class($this)));
}
$this->subject = $subject;
$this->context = $context;
$this->group = $group;
$this->constraintValidatorFactory = $constraintValidatorFactory;
$this->current = '';
$this->basePropertyPath = $this->context->getPropertyPath();
}
示例3: isVoteValid
/**
* {@inheritdoc}
*/
public function isVoteValid(ExecutionContextInterface $context)
{
if (!$this->checkValue($this->value)) {
$message = 'A vote cannot have a 0 value';
$propertyPath = $context->getPropertyPath() . '.value';
$context->addViolationAt($propertyPath, $message);
}
}
示例4: let
function let(ProductManager $productManager, ExecutionContextInterface $context, Form $form, ProductInterface $product, ProductValueInterface $value)
{
$this->beConstructedWith($productManager);
$product->getValue('sku')->willReturn($value);
$form->getData()->willReturn($product);
$context->getPropertyPath()->willReturn(self::PROPERTY_PATH);
$context->getRoot()->willReturn($form);
$this->initialize($context);
}
示例5: let
function let(ProductRepositoryInterface $productRepository, UniqueValuesSet $uniqueValuesSet, ExecutionContextInterface $context, Form $form, ProductInterface $product, ProductValueInterface $value)
{
$this->beConstructedWith($productRepository, $uniqueValuesSet);
$product->getValue('unique_attribute')->willReturn($value);
$form->getData()->willReturn($product);
$context->getPropertyPath()->willReturn(self::PROPERTY_PATH);
$context->getRoot()->willReturn($form);
$this->initialize($context);
}
示例6: isVoteValid
/**
* {@inheritdoc}
*/
public function isVoteValid(ExecutionContextInterface $context)
{
if (!$this->checkValue($this->value)) {
$message = 'A vote cannot have a 0 value';
$propertyPath = $context->getPropertyPath() . '.value';
if ($context instanceof \Symfony\Component\Validator\Context\ExecutionContextInterface) {
// Validator 2.5 API
$context->buildViolation($message)->atPath($propertyPath)->addViolation();
} else {
$context->addViolationAt($propertyPath, $message);
}
}
}
示例7: getRowData
private function getRowData(ExecutionContextInterface $context)
{
$propertyPath = $context->getPropertyPath();
$data = $this->getRowData($context);
}