public function getRelationships($entity, $isPrimary, array $includeRelationships)
    {
        $relations = [];

        foreach ($this->_repository->associations() as $association) {
            $property = $association->getProperty();

            $data = $entity->get($property);
            if (!$data) {
                continue;
            }

            // change related  data in entity to dasherized if need be
            if ($this->_view->viewVars['_inflect'] === 'dasherize') {
                $dasherizedProperty = Inflector::dasherize($property);

                if (empty($entity->$dasherizedProperty)) {
                    $entity->$dasherizedProperty = $entity->$property;
                    unset($entity->$property);
                    $property = $dasherizedProperty;
                }
            }

            $relations[$property] = [
                self::DATA => $data,
                self::SHOW_SELF => true,
                self::SHOW_RELATED => false,
            ];
        }

        return $relations;
    }
public function getRelationships($entity, $isPrimary, array $includeRelationships)
    {
        $relations = [];

        foreach ($this->_repository->associations() as $association) {
            $property = $association->getProperty();

            $data = $entity->get($property);
            if (!$data) {
                continue;
            }

            // change related  data in entity to dasherized if need be
            if ($this->_view->viewVars['_inflect'] === 'dasherize') {
                $dasherizedProperty = Inflector::dasherize($property);

                if (empty($entity->$dasherizedProperty)) {
                    $entity->$dasherizedProperty = $entity->$property;
                    unset($entity->$property);
                    $property = $dasherizedProperty;
                }
            }

            $relations[$property] = [
                self::DATA => $data,
                self::SHOW_SELF => true,
                self::SHOW_RELATED => false,
            ];
        }

        return $relations;
    }
public function getRelationships ( $ entity , $ isPrimary , array $ includeRelationships ) { $ relations = [ ] ; foreach ( $ this -> _repository -> associations ( ) as $ association ) { $ property = $ association -> getProperty ( ) ; $ data = $ entity -> get ( $ property ) ; if ( ! $ data ) { continue ; } // change related  data in entity to dasherized if need be if ( $ this -> _view -> viewVars [ '_inflect' ] === 'dasherize' ) { $ dasherizedProperty = Inflector :: dasherize ( $ property ) ; if ( empty ( $ entity -> $ dasherizedProperty ) ) { $ entity -> $ dasherizedProperty = $ entity -> $ property ; unset ( $ entity -> $ property ) ; $ property = $ dasherizedProperty ; } } $ relations [ $ property ] = [ self :: DATA => $ data , self :: SHOW_SELF => true , self :: SHOW_RELATED => false , ] ; } return $ relations ; }
NeoMerx override used to pass associated entity names to be used for
generating JsonApi `relationships`.

JSON API optional `related` links not implemented yet.

@param \Cake\Datasource\EntityInterface $entity Entity object
@param bool $isPrimary True to add resource to data section instead of included
@param array $includeRelationships Used to fine tune relationships
@return array
NeoMerx override used to pass associated entity names to be used for generating JsonApi relationships .