protected function hasViolationForPropertyPath($violations, $propertyPath) { if (!is_object($violations)) { return false; } foreach ($violations as $violation) { if ($violation->getPropertyPath() == $propertyPath) { return true; } } return false; }