public static function getDefaultFields($model, $extra = false)
    {
        $fields = $extra ? [] : $model->attributes();
        foreach ($model->relations() as $relation) {
            $activeRelation = $model->getRelation($relation);
            if ((!$extra && $activeRelation->multiple) || ($extra && !$activeRelation->multiple)) {
                continue;
            }
            $fields[] = $relation;
        }
        return $fields;
    }
public static function getDefaultFields($model, $extra = false)
    {
        $fields = $extra ? [] : $model->attributes();
        foreach ($model->relations() as $relation) {
            $activeRelation = $model->getRelation($relation);
            if ((!$extra && $activeRelation->multiple) || ($extra && !$activeRelation->multiple)) {
                continue;
            }
            $fields[] = $relation;
        }
        return $fields;
    }
public static function getDefaultFields ( $ model , $ extra = false ) { $ fields = $ extra ? [ ] : $ model -> attributes ( ) ; foreach ( $ model -> relations ( ) as $ relation ) { $ activeRelation = $ model -> getRelation ( $ relation ) ; if ( ( ! $ extra && $ activeRelation -> multiple ) || ( $ extra && ! $ activeRelation -> multiple ) ) { continue ; } $ fields [ ] = $ relation ; } return $ fields ; }
Returns default fields list by combining model attributes with hasOne relations or just hasMany relations.
@param ActiveRecord $model
@param bool $extra if false, returns attributes and hasOne relations, if true, returns only hasMany relations
@return array default list of fields
Returns default fields list by combining model attributes with hasOne relations or just hasMany relations .