public function __construct(ExecutionContextInterface $context, $message, array $parameters) { $this->context = $context; $this->message = $message; $this->parameters = $parameters; $this->invalidValue = $context->getValue(); }
/** * @param $event * @param ExecutionContextInterface $context */ public function validateCountInDir($event, ExecutionContextInterface $context) { $path = $this->getFilePath($context->getValue()); $countFiles = count(glob("{$path}*.*")); if ($countFiles >= self::MAX_FILES) { $context->addViolation("Maximum " . self::MAX_FILES . " files in the category", array(), null); } }