protected function _relationshipDataMustHaveType($relationship, $path)
    {
        $path = $this->_getPathObject($path);

        // generate correct feedback and path for hasMany and belongsTo relationships
        $array = $this->_getProperty($path);
        $arrayDepth = Hash::dimensions($array);

        if ($arrayDepth === 1) {
            $searchPath = $path->dotted . '.type'; // hasMany
            $pointer = $relationship . '/data/' . $path->key;
        } else {
            $searchPath = $path->dotted . '.data.type'; // belongsTo
            $pointer = $relationship . '/data';
        }

        // make sure the relationship data has the `type` key
        if (!$this->_hasProperty($searchPath)) {
            $this->_errorCollection->addRelationshipError(
                $name = $pointer,
                $title = '_required',
                $detail = "Relationship data does not contain member 'type'",
                $status = null,
                $idx = null,
                $aboutLink = $this->_getAboutLink('http://jsonapi.org/format/#crud-creating')
            );

            return false;
        }

        // key exists so update the pointer before checking if value is a string
        $pointer = $pointer . '/type';

        if (!$this->_isString($searchPath)) {
            $this->_errorCollection->addRelationshipError(
                $name = $pointer,
                $title = '_required',
                $detail = "Relationship data member 'type' is not a string",
                $status = null,
                $idx = null,
                $aboutLink = $this->_getAboutLink('http://jsonapi.org/format/#crud-creating')
            );

            return false;
        }

        return true;
    }
protected function _relationshipDataMustHaveType($relationship, $path)
    {
        $path = $this->_getPathObject($path);

        // generate correct feedback and path for hasMany and belongsTo relationships
        $array = $this->_getProperty($path);
        $arrayDepth = Hash::dimensions($array);

        if ($arrayDepth === 1) {
            $searchPath = $path->dotted . '.type'; // hasMany
            $pointer = $relationship . '/data/' . $path->key;
        } else {
            $searchPath = $path->dotted . '.data.type'; // belongsTo
            $pointer = $relationship . '/data';
        }

        // make sure the relationship data has the `type` key
        if (!$this->_hasProperty($searchPath)) {
            $this->_errorCollection->addRelationshipError(
                $name = $pointer,
                $title = '_required',
                $detail = "Relationship data does not contain member 'type'",
                $status = null,
                $idx = null,
                $aboutLink = $this->_getAboutLink('http://jsonapi.org/format/#crud-creating')
            );

            return false;
        }

        // key exists so update the pointer before checking if value is a string
        $pointer = $pointer . '/type';

        if (!$this->_isString($searchPath)) {
            $this->_errorCollection->addRelationshipError(
                $name = $pointer,
                $title = '_required',
                $detail = "Relationship data member 'type' is not a string",
                $status = null,
                $idx = null,
                $aboutLink = $this->_getAboutLink('http://jsonapi.org/format/#crud-creating')
            );

            return false;
        }

        return true;
    }
protected function _relationshipDataMustHaveType ( $ relationship , $ path ) { $ path = $ this -> _getPathObject ( $ path ) ; // generate correct feedback and path for hasMany and belongsTo relationships $ array = $ this -> _getProperty ( $ path ) ; $ arrayDepth = Hash :: dimensions ( $ array ) ; if ( $ arrayDepth === 1 ) { $ searchPath = $ path -> dotted . '.type' ; // hasMany $ pointer = $ relationship . '/data/' . $ path -> key ; } else { $ searchPath = $ path -> dotted . '.data.type' ; // belongsTo $ pointer = $ relationship . '/data' ; } // make sure the relationship data has the `type` key if ( ! $ this -> _hasProperty ( $ searchPath ) ) { $ this -> _errorCollection -> addRelationshipError ( $ name = $ pointer , $ title = '_required' , $ detail = "Relationship data does not contain member 'type'" , $ status = null , $ idx = null , $ aboutLink = $ this -> _getAboutLink ( 'http://jsonapi.org/format/#crud-creating' ) ) ; return false ; } // key exists so update the pointer before checking if value is a string $ pointer = $ pointer . '/type' ; if ( ! $ this -> _isString ( $ searchPath ) ) { $ this -> _errorCollection -> addRelationshipError ( $ name = $ pointer , $ title = '_required' , $ detail = "Relationship data member 'type' is not a string" , $ status = null , $ idx = null , $ aboutLink = $ this -> _getAboutLink ( 'http://jsonapi.org/format/#crud-creating' ) ) ; return false ; } return true ; }
Ensures a relationship data has a 'type' member.

@param string $relationship Singular or plural relationship name
@param string|stdClass $path Dot separated path of relationship object or path object
@return bool
Ensures a relationship data has a type member .