Domain/BaseDomain.php
protected function validateResource($resource, $type): void
    {
        if (!$resource->isValid()) {
            return;
        }

        $idError = $this->getErrorIdentifier($resource->getRealData(), $type);
        $data = $resource->getData();

        if ($data instanceof FormInterface) {
            if (!$data->isSubmitted()) {
                $data->submit([]);
            }
        } else {
            $errors = $this->validator->validate($data);
            $resource->getErrors()->addAll($errors);
        }

        if (null !== $idError) {
            $resource->getErrors()->add(new ConstraintViolation($idError, $idError, [], $resource->getRealData(), null, null));
        }
    }
protected function validateResource($resource, $type): void
    {
        if (!$resource->isValid()) {
            return;
        }

        $idError = $this->getErrorIdentifier($resource->getRealData(), $type);
        $data = $resource->getData();

        if ($data instanceof FormInterface) {
            if (!$data->isSubmitted()) {
                $data->submit([]);
            }
        } else {
            $errors = $this->validator->validate($data);
            $resource->getErrors()->addAll($errors);
        }

        if (null !== $idError) {
            $resource->getErrors()->add(new ConstraintViolation($idError, $idError, [], $resource->getRealData(), null, null));
        }
    }
protected function validateResource ( $ resource , $ type ) : void { if ( ! $ resource -> isValid ( ) ) { return ; } $ idError = $ this -> getErrorIdentifier ( $ resource -> getRealData ( ) , $ type ) ; $ data = $ resource -> getData ( ) ; if ( $ data instanceof FormInterface ) { if ( ! $ data -> isSubmitted ( ) ) { $ data -> submit ( [ ] ) ; } } else { $ errors = $ this -> validator -> validate ( $ data ) ; $ resource -> getErrors ( ) -> addAll ( $ errors ) ; } if ( null !== $ idError ) { $ resource -> getErrors ( ) -> add ( new ConstraintViolation ( $ idError , $ idError , [ ] , $ resource -> getRealData ( ) , null , null ) ) ; } }
Validate the resource and get the error list.

@param ResourceInterface $resource The resource
@param int               $type     The type of persist
Validate the resource and get the error list .