Domain/DomainUtil.php
public static function moveFlushErrorsInResource(ResourceListInterface $resources, ConstraintViolationListInterface $errors): void
    {
        if ($errors->count() > 0) {
            $maps = static::getMapErrors($errors);

            foreach ($resources->all() as $resource) {
                $resource->setStatus(ResourceStatutes::ERROR);
                $hash = spl_object_hash($resource->getRealData());
                if (isset($maps[$hash])) {
                    $resource->getErrors()->add($maps[$hash]);
                    unset($maps[$hash]);
                }
            }

            foreach ($maps as $error) {
                $resources->getErrors()->add($error);
            }
        }
    }
public static function moveFlushErrorsInResource(ResourceListInterface $resources, ConstraintViolationListInterface $errors): void
    {
        if ($errors->count() > 0) {
            $maps = static::getMapErrors($errors);

            foreach ($resources->all() as $resource) {
                $resource->setStatus(ResourceStatutes::ERROR);
                $hash = spl_object_hash($resource->getRealData());
                if (isset($maps[$hash])) {
                    $resource->getErrors()->add($maps[$hash]);
                    unset($maps[$hash]);
                }
            }

            foreach ($maps as $error) {
                $resources->getErrors()->add($error);
            }
        }
    }
public static function moveFlushErrorsInResource ( ResourceListInterface $ resources , ConstraintViolationListInterface $ errors ) : void { if ( $ errors -> count ( ) > 0 ) { $ maps = static :: getMapErrors ( $ errors ) ; foreach ( $ resources -> all ( ) as $ resource ) { $ resource -> setStatus ( ResourceStatutes :: ERROR ) ; $ hash = spl_object_hash ( $ resource -> getRealData ( ) ) ; if ( isset ( $ maps [ $ hash ] ) ) { $ resource -> getErrors ( ) -> add ( $ maps [ $ hash ] ) ; unset ( $ maps [ $ hash ] ) ; } } foreach ( $ maps as $ error ) { $ resources -> getErrors ( ) -> add ( $ error ) ; } } }
Move the flush errors in each resource if the root object is present in constraint violation.

@param ResourceListInterface            $resources The list of resources
@param ConstraintViolationListInterface $errors    The list of flush errors
Move the flush errors in each resource if the root object is present in constraint violation .