src/Controller/Base.php
protected static function getRequestInclude($parameters, $modelClass = null)
    {
        //work with arrays
        if (!is_object($parameters) && is_array($parameters)) {
            $parameters = (object) $parameters;
        }

        $include = [];

        if ($modelClass !== null) {
            //Add additional include by default from resource model's relationships
            foreach ($modelClass::getRelationships() as $relationshipKey => $relationship) {
                if (($relationship->flags & Relationship::FLAG_INCLUDE_BY_DEFAULT) != 0) {
                    $include[] = $include;
                }
            }
        }

        if (!isset($parameters->include) || empty($parameters->include)) {
            return $include;
        }

        //split parameter using , (for multiple values)
        foreach (explode(',', $parameters->include) as $i) {
            $include[] = trim($i);
        }

        return array_unique($include);
    }
protected static function getRequestInclude($parameters, $modelClass = null)
    {
        //work with arrays
        if (!is_object($parameters) && is_array($parameters)) {
            $parameters = (object) $parameters;
        }

        $include = [];

        if ($modelClass !== null) {
            //Add additional include by default from resource model's relationships
            foreach ($modelClass::getRelationships() as $relationshipKey => $relationship) {
                if (($relationship->flags & Relationship::FLAG_INCLUDE_BY_DEFAULT) != 0) {
                    $include[] = $include;
                }
            }
        }

        if (!isset($parameters->include) || empty($parameters->include)) {
            return $include;
        }

        //split parameter using , (for multiple values)
        foreach (explode(',', $parameters->include) as $i) {
            $include[] = trim($i);
        }

        return array_unique($include);
    }
protected static function getRequestInclude ( $ parameters , $ modelClass = null ) { //work with arrays if ( ! is_object ( $ parameters ) && is_array ( $ parameters ) ) { $ parameters = ( object ) $ parameters ; } $ include = [ ] ; if ( $ modelClass !== null ) { //Add additional include by default from resource model's relationships foreach ( $ modelClass :: getRelationships ( ) as $ relationshipKey => $ relationship ) { if ( ( $ relationship -> flags & Relationship :: FLAG_INCLUDE_BY_DEFAULT ) != 0 ) { $ include [ ] = $ include ; } } } if ( ! isset ( $ parameters -> include ) || empty ( $ parameters -> include ) ) { return $ include ; } //split parameter using , (for multiple values) foreach ( explode ( ',' , $ parameters -> include ) as $ i ) { $ include [ ] = trim ( $ i ) ; } return array_unique ( $ include ) ; }
Extract included related resources from parameters
@param object $parameters Request parameters
@param string|null $modelClass If not null, will add additional include by default from resource model's relationships
@return string[]
Extract included related resources from parameters