Closed
Description
Hey,
I'm looking a way to detect extra field violation from a violation list.
Currently, when I got a violation list, the only way I found to detect them is :
$constraintViolationList = ...;
foreach ($constraintViolationList as $violation) {
if (
Collection::NO_SUCH_FIELD_ERROR === $violation->getCode() &&
$violation->getMessage() === "This field was not expected."
) {
// this is an extra field
}
}
Comparison with string is pretty dirty :/
Am I missing something?