Skip to content
Snippets Groups Projects

feaT: add SequentiallyConstraint and childs and test if we can have our...

Files

@@ -93,8 +93,16 @@ public function validate($data, $constraints = NULL, $groups = NULL, $is_root_ca
throw new \LogicException('Passing custom groups is not supported.');
}
// Convert to TypedDataInterface if it matches the context object's value
if (!$data instanceof TypedDataInterface) {
throw new \InvalidArgumentException('The passed value must be a typed data object.');
$context_object = $this->context->getObject();
if ($context_object instanceof TypedDataInterface && $data === $context_object->getValue()) {
$data = $context_object;
}
else {
throw new \InvalidArgumentException('The passed value must be a typed data object.');
}
}
// You can pass a single constraint or an array of constraints.
Loading