src/Generator/ModelWriter.php
protected function appendRelatedModelsToModelData(array $model)
    {
        $relationships = array_merge(
            array_get($model, 'relationships.normal'),
            array_get($model, 'relationships.reverse')
        );

        $model['related_models'] = [];

        foreach ($relationships as $name => $relationship) {

            $relatedModelId = $relationship['model'];

            if (isset($model['related_models'][ $relatedModelId ])) continue;

            $model['related_models'][ $relatedModelId ] = $this->data['models'][ $relatedModelId ];
        }

        return $model;
    }
protected function appendRelatedModelsToModelData(array $model)
    {
        $relationships = array_merge(
            array_get($model, 'relationships.normal'),
            array_get($model, 'relationships.reverse')
        );

        $model['related_models'] = [];

        foreach ($relationships as $name => $relationship) {

            $relatedModelId = $relationship['model'];

            if (isset($model['related_models'][ $relatedModelId ])) continue;

            $model['related_models'][ $relatedModelId ] = $this->data['models'][ $relatedModelId ];
        }

        return $model;
    }
protected function appendRelatedModelsToModelData ( array $ model ) { $ relationships = array_merge ( array_get ( $ model , 'relationships.normal' ) , array_get ( $ model , 'relationships.reverse' ) ) ; $ model [ 'related_models' ] = [ ] ; foreach ( $ relationships as $ name => $ relationship ) { $ relatedModelId = $ relationship [ 'model' ] ; if ( isset ( $ model [ 'related_models' ] [ $ relatedModelId ] ) ) continue ; $ model [ 'related_models' ] [ $ relatedModelId ] = $ this -> data [ 'models' ] [ $ relatedModelId ] ; } return $ model ; }
Append 'related' model data for related models

@param array $model
@return array
Append related model data for related models