protected function _nestedErrors($field)
    {
        $path = explode('.', $field);

        // Only one path element, check for nested entity with error.
        if (count($path) === 1) {
            return $this->_readError($this->get($path[0]));
        }

        $entity = $this;
        $len = count($path);
        while ($len) {
            $part = array_shift($path);
            $len = count($path);
            $val = null;
            if ($entity instanceof EntityInterface) {
                $val = $entity->get($part);
            } elseif (is_array($entity)) {
                $val = isset($entity[$part]) ? $entity[$part] : false;
            }

            if (is_array($val) ||
                $val instanceof Traversable ||
                $val instanceof EntityInterface
            ) {
                $entity = $val;
            } else {
                $path[] = $part;
                break;
            }
        }
        if (count($path) <= 1) {
            return $this->_readError($entity, array_pop($path));
        }

        return [];
    }
protected function _nestedErrors($field)
    {
        $path = explode('.', $field);

        // Only one path element, check for nested entity with error.
        if (count($path) === 1) {
            return $this->_readError($this->get($path[0]));
        }

        $entity = $this;
        $len = count($path);
        while ($len) {
            $part = array_shift($path);
            $len = count($path);
            $val = null;
            if ($entity instanceof EntityInterface) {
                $val = $entity->get($part);
            } elseif (is_array($entity)) {
                $val = isset($entity[$part]) ? $entity[$part] : false;
            }

            if (is_array($val) ||
                $val instanceof Traversable ||
                $val instanceof EntityInterface
            ) {
                $entity = $val;
            } else {
                $path[] = $part;
                break;
            }
        }
        if (count($path) <= 1) {
            return $this->_readError($entity, array_pop($path));
        }

        return [];
    }
protected function _nestedErrors ( $ field ) { $ path = explode ( '.' , $ field ) ; // Only one path element, check for nested entity with error. if ( count ( $ path ) === 1 ) { return $ this -> _readError ( $ this -> get ( $ path [ 0 ] ) ) ; } $ entity = $ this ; $ len = count ( $ path ) ; while ( $ len ) { $ part = array_shift ( $ path ) ; $ len = count ( $ path ) ; $ val = null ; if ( $ entity instanceof EntityInterface ) { $ val = $ entity -> get ( $ part ) ; } elseif ( is_array ( $ entity ) ) { $ val = isset ( $ entity [ $ part ] ) ? $ entity [ $ part ] : false ; } if ( is_array ( $ val ) || $ val instanceof Traversable || $ val instanceof EntityInterface ) { $ entity = $ val ; } else { $ path [ ] = $ part ; break ; } } if ( count ( $ path ) <= 1 ) { return $ this -> _readError ( $ entity , array_pop ( $ path ) ) ; } return [ ] ; }
Auxiliary method for getting errors in nested entities

@param string $field the field in this entity to check for errors
@return array errors in nested entity if any
Auxiliary method for getting errors in nested entities