protected function _includeParameter($includes, Subject $subject, $options)
    {
        if (is_string($includes)) {
            $includes = explode(',', $includes);
        }
        $includes = Hash::filter((array)$includes);

        if (empty($includes)) {
            return;
        }

        if ($options['blacklist'] === true || $options['whitelist'] === false) {
            throw new BadRequestException("The include parameter is not supported");
        }

        $this->setConfig('include', []);

        $includes = Hash::expand(Hash::normalize($includes));
        $blacklist = is_array($options['blacklist']) ? Hash::expand(Hash::normalize(array_fill_keys($options['blacklist'], true))) : $options['blacklist'];
        $whitelist = is_array($options['whitelist']) ? Hash::expand(Hash::normalize(array_fill_keys($options['whitelist'], true))) : $options['whitelist'];
        $contains = $this->_parseIncludes($includes, $blacklist, $whitelist, $subject->query->getRepository());

        $subject->query->contain($contains);

        $this->setConfig('include', []);
        $associations = $this->_getContainedAssociations($subject->query->getRepository(), $contains);
        $include = $this->_getIncludeList($associations);

        $this->setConfig('include', $include);
    }
protected function _includeParameter($includes, Subject $subject, $options)
    {
        if (is_string($includes)) {
            $includes = explode(',', $includes);
        }
        $includes = Hash::filter((array)$includes);

        if (empty($includes)) {
            return;
        }

        if ($options['blacklist'] === true || $options['whitelist'] === false) {
            throw new BadRequestException("The include parameter is not supported");
        }

        $this->setConfig('include', []);

        $includes = Hash::expand(Hash::normalize($includes));
        $blacklist = is_array($options['blacklist']) ? Hash::expand(Hash::normalize(array_fill_keys($options['blacklist'], true))) : $options['blacklist'];
        $whitelist = is_array($options['whitelist']) ? Hash::expand(Hash::normalize(array_fill_keys($options['whitelist'], true))) : $options['whitelist'];
        $contains = $this->_parseIncludes($includes, $blacklist, $whitelist, $subject->query->getRepository());

        $subject->query->contain($contains);

        $this->setConfig('include', []);
        $associations = $this->_getContainedAssociations($subject->query->getRepository(), $contains);
        $include = $this->_getIncludeList($associations);

        $this->setConfig('include', $include);
    }
protected function _includeParameter ( $ includes , Subject $ subject , $ options ) { if ( is_string ( $ includes ) ) { $ includes = explode ( ',' , $ includes ) ; } $ includes = Hash :: filter ( ( array ) $ includes ) ; if ( empty ( $ includes ) ) { return ; } if ( $ options [ 'blacklist' ] === true || $ options [ 'whitelist' ] === false ) { throw new BadRequestException ( "The include parameter is not supported" ) ; } $ this -> setConfig ( 'include' , [ ] ) ; $ includes = Hash :: expand ( Hash :: normalize ( $ includes ) ) ; $ blacklist = is_array ( $ options [ 'blacklist' ] ) ? Hash :: expand ( Hash :: normalize ( array_fill_keys ( $ options [ 'blacklist' ] , true ) ) ) : $ options [ 'blacklist' ] ; $ whitelist = is_array ( $ options [ 'whitelist' ] ) ? Hash :: expand ( Hash :: normalize ( array_fill_keys ( $ options [ 'whitelist' ] , true ) ) ) : $ options [ 'whitelist' ] ; $ contains = $ this -> _parseIncludes ( $ includes , $ blacklist , $ whitelist , $ subject -> query -> getRepository ( ) ) ; $ subject -> query -> contain ( $ contains ) ; $ this -> setConfig ( 'include' , [ ] ) ; $ associations = $ this -> _getContainedAssociations ( $ subject -> query -> getRepository ( ) , $ contains ) ; $ include = $ this -> _getIncludeList ( $ associations ) ; $ this -> setConfig ( 'include' , $ include ) ; }
Parses out include query parameter into a containable array, and contains the query.

Supported options is "Whitelist" and "Blacklist"

@param string|array $includes The query data
@param \Crud\Event\Subject $subject The subject
@param array $options Array of options for includes.
@return void
Parses out include query parameter into a containable array and contains the query .