src/Generator/Writer/Model/Steps/StubReplaceAccessorsAndMutators.php
protected function collectNormalBelongsToRelationAccessors()
    {
        $accessors = [];

        foreach ($this->data['relationships']['normal'] as $name => $relationship) {
            if ($relationship['type'] != Generator::RELATIONSHIP_BELONGS_TO) continue;
            if ( ! empty($relationship['key']) && snake_case($name) !== $relationship['key']) continue;

            $attributeName = snake_case($name);

            $content = $this->tab(2) . "return \$this->getBelongsToRelationAttributeValue('{$name}');\n";

            $accessors[ $name ] = [
                'attribute' => $attributeName,
                'content'   => $content,
            ];
        }

        return $accessors;
    }
protected function collectNormalBelongsToRelationAccessors()
    {
        $accessors = [];

        foreach ($this->data['relationships']['normal'] as $name => $relationship) {
            if ($relationship['type'] != Generator::RELATIONSHIP_BELONGS_TO) continue;
            if ( ! empty($relationship['key']) && snake_case($name) !== $relationship['key']) continue;

            $attributeName = snake_case($name);

            $content = $this->tab(2) . "return \$this->getBelongsToRelationAttributeValue('{$name}');\n";

            $accessors[ $name ] = [
                'attribute' => $attributeName,
                'content'   => $content,
            ];
        }

        return $accessors;
    }
protected function collectNormalBelongsToRelationAccessors ( ) { $ accessors = [ ] ; foreach ( $ this -> data [ 'relationships' ] [ 'normal' ] as $ name => $ relationship ) { if ( $ relationship [ 'type' ] != Generator :: RELATIONSHIP_BELONGS_TO ) continue ; if ( ! empty ( $ relationship [ 'key' ] ) && snake_case ( $ name ) !== $ relationship [ 'key' ] ) continue ; $ attributeName = snake_case ( $ name ) ; $ content = $ this -> tab ( 2 ) . "return \$this->getBelongsToRelationAttributeValue('{$name}');\n" ; $ accessors [ $ name ] = [ 'attribute' => $ attributeName , 'content' => $ content , ] ; } return $ accessors ; }
For belongs-to relationships that share foreign key & relation name

@return array    name => array with properties
For belongs - to relationships that share foreign key & relation name