src/Generator/Writer/Model/Steps/StubReplaceRelationData.php
protected function normalizeRelationsData()
    {
        if (is_null($this->data['relationships'])) {
            $this->data['relationships'] = [];
        }

        foreach ([ 'normal', 'reverse', 'image', 'file', 'checkbox', 'category' ] as $key) {

            if (    ! array_key_exists($key, $this->data['relationships'])
                ||  ! is_array($this->data['relationships'][ $key ])
            ) {
                $this->data->relationships[ $key ] = [];
            }
        }

        return $this;
    }
protected function normalizeRelationsData()
    {
        if (is_null($this->data['relationships'])) {
            $this->data['relationships'] = [];
        }

        foreach ([ 'normal', 'reverse', 'image', 'file', 'checkbox', 'category' ] as $key) {

            if (    ! array_key_exists($key, $this->data['relationships'])
                ||  ! is_array($this->data['relationships'][ $key ])
            ) {
                $this->data->relationships[ $key ] = [];
            }
        }

        return $this;
    }
protected function normalizeRelationsData ( ) { if ( is_null ( $ this -> data [ 'relationships' ] ) ) { $ this -> data [ 'relationships' ] = [ ] ; } foreach ( [ 'normal' , 'reverse' , 'image' , 'file' , 'checkbox' , 'category' ] as $ key ) { if ( ! array_key_exists ( $ key , $ this -> data [ 'relationships' ] ) || ! is_array ( $ this -> data [ 'relationships' ] [ $ key ] ) ) { $ this -> data -> relationships [ $ key ] = [ ] ; } } return $ this ; }
Makes sure that expected relations data is traversable

@return $this
Makes sure that expected relations data is traversable