validateProject($value, $this->context); } protected function validateProject(Project $project, ExecutionContextInterface $context) { if (null !== $project->getStart() && null !== $project->getEnd() && $project->getStart()->getTimestamp() > $project->getEnd()->getTimestamp()) { $context->buildViolation('End date must not be earlier then start date.') ->atPath('end') ->setTranslationDomain('validators') ->setCode(ProjectConstraint::END_BEFORE_BEGIN_ERROR) ->addViolation(); } } }