public function toState()
    {
        $state = [];
        foreach ($this->getErrors() as $error) {
            $state[$error->getName()] = [];
            foreach ($error->getErrors() as $violation) {
                $state[$error->getName()][] = [
                    'path' => $violation->getPropertyPath(),
                    'message' => $violation->getMessage(),
                    'code' => $violation->getCode(),
                ];
            }
        }

        return $state;
    }
public function toState()
    {
        $state = [];
        foreach ($this->getErrors() as $error) {
            $state[$error->getName()] = [];
            foreach ($error->getErrors() as $violation) {
                $state[$error->getName()][] = [
                    'path' => $violation->getPropertyPath(),
                    'message' => $violation->getMessage(),
                    'code' => $violation->getCode(),
                ];
            }
        }

        return $state;
    }
public function toState ( ) { $ state = [ ] ; foreach ( $ this -> getErrors ( ) as $ error ) { $ state [ $ error -> getName ( ) ] = [ ] ; foreach ( $ error -> getErrors ( ) as $ violation ) { $ state [ $ error -> getName ( ) ] [ ] = [ 'path' => $ violation -> getPropertyPath ( ) , 'message' => $ violation -> getMessage ( ) , 'code' => $ violation -> getCode ( ) , ] ; } } return $ state ; }
Return a serializable array of validation errors for each argument.

@return array
Return a serializable array of validation errors for each argument .