/** * @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(); }
/** * @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(); }
/** * {@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); } }
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); }
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); }
/** * {@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); } } }
private function getRowData(ExecutionContextInterface $context) { $propertyPath = $context->getPropertyPath(); $data = $this->getRowData($context); }