protected function _getRelatedModels($associationTypes = [])
    {
        $models = $this->_action()->getConfig('scaffold.relations');

        if ($models === false) {
            return [];
        }

        if (empty($models)) {
            $associations = [];
            if (empty($associationTypes)) {
                $associations = $this->_table()->associations();
            } else {
                foreach ($associationTypes as $assocType) {
                    $associations = array_merge(
                        $associations,
                        $this->_table()->associations()->getByType($assocType)
                    );
                }
            }

            $models = [];
            foreach ($associations as $assoc) {
                $models[] = $assoc->getName();
            }
        }

        $models = Hash::normalize($models);

        $blacklist = $this->_action()->getConfig('scaffold.relations_blacklist');
        if (!empty($blacklist)) {
            $blacklist = Hash::normalize($blacklist);
            $models = array_diff_key($models, $blacklist);
        }

        foreach ($models as $key => $value) {
            if (!is_array($value)) {
                $models[$key] = [];
            }
        }

        return $models;
    }
protected function _getRelatedModels($associationTypes = [])
    {
        $models = $this->_action()->getConfig('scaffold.relations');

        if ($models === false) {
            return [];
        }

        if (empty($models)) {
            $associations = [];
            if (empty($associationTypes)) {
                $associations = $this->_table()->associations();
            } else {
                foreach ($associationTypes as $assocType) {
                    $associations = array_merge(
                        $associations,
                        $this->_table()->associations()->getByType($assocType)
                    );
                }
            }

            $models = [];
            foreach ($associations as $assoc) {
                $models[] = $assoc->getName();
            }
        }

        $models = Hash::normalize($models);

        $blacklist = $this->_action()->getConfig('scaffold.relations_blacklist');
        if (!empty($blacklist)) {
            $blacklist = Hash::normalize($blacklist);
            $models = array_diff_key($models, $blacklist);
        }

        foreach ($models as $key => $value) {
            if (!is_array($value)) {
                $models[$key] = [];
            }
        }

        return $models;
    }
protected function _getRelatedModels ( $ associationTypes = [ ] ) { $ models = $ this -> _action ( ) -> getConfig ( 'scaffold.relations' ) ; if ( $ models === false ) { return [ ] ; } if ( empty ( $ models ) ) { $ associations = [ ] ; if ( empty ( $ associationTypes ) ) { $ associations = $ this -> _table ( ) -> associations ( ) ; } else { foreach ( $ associationTypes as $ assocType ) { $ associations = array_merge ( $ associations , $ this -> _table ( ) -> associations ( ) -> getByType ( $ assocType ) ) ; } } $ models = [ ] ; foreach ( $ associations as $ assoc ) { $ models [ ] = $ assoc -> getName ( ) ; } } $ models = Hash :: normalize ( $ models ) ; $ blacklist = $ this -> _action ( ) -> getConfig ( 'scaffold.relations_blacklist' ) ; if ( ! empty ( $ blacklist ) ) { $ blacklist = Hash :: normalize ( $ blacklist ) ; $ models = array_diff_key ( $ models , $ blacklist ) ; } foreach ( $ models as $ key => $ value ) { if ( ! is_array ( $ value ) ) { $ models [ $ key ] = [ ] ; } } return $ models ; }
Get a list of relevant models to contain using Containable

If the user hasn't configured any relations for an action
we assume all relations will be used.

The user can choose to suppress specific relations using the blacklist
functionality.

@param string[] $associationTypes List of association types.
@return array
Get a list of relevant models to contain using Containable