public function getRelatedFields()
    {
        if (is_string($this->relation->toModel)) {
            throw new ValueError(
                sprintf(
                    'Related model "%s" cannot be resolved',
                    $this->relation->toModel
                )
            );
        }
        // owning side of a relation

        if (BaseOrm::RECURSIVE_RELATIONSHIP_CONSTANT == $this->fromField) {
            $this->fromField = $this;
        } elseif (is_string($this->fromField)) {
            $this->fromField = $this->scopeModel->getMeta()->getField($this->fromField);
        }

        //inverse side of a relation
        if (is_string($this->toField)) {
            $this->toField = $this->relation->toModel->getMeta()->getField($this->toField);
        } else {
            $this->toField = $this->relation->toModel->getMeta()->primaryKey;
        }

        return [$this->fromField, $this->toField];
    }
public function getRelatedFields()
    {
        if (is_string($this->relation->toModel)) {
            throw new ValueError(
                sprintf(
                    'Related model "%s" cannot be resolved',
                    $this->relation->toModel
                )
            );
        }
        // owning side of a relation

        if (BaseOrm::RECURSIVE_RELATIONSHIP_CONSTANT == $this->fromField) {
            $this->fromField = $this;
        } elseif (is_string($this->fromField)) {
            $this->fromField = $this->scopeModel->getMeta()->getField($this->fromField);
        }

        //inverse side of a relation
        if (is_string($this->toField)) {
            $this->toField = $this->relation->toModel->getMeta()->getField($this->toField);
        } else {
            $this->toField = $this->relation->toModel->getMeta()->primaryKey;
        }

        return [$this->fromField, $this->toField];
    }
public function getRelatedFields ( ) { if ( is_string ( $ this -> relation -> toModel ) ) { throw new ValueError ( sprintf ( 'Related model "%s" cannot be resolved' , $ this -> relation -> toModel ) ) ; } // owning side of a relation if ( BaseOrm :: RECURSIVE_RELATIONSHIP_CONSTANT == $ this -> fromField ) { $ this -> fromField = $ this ; } elseif ( is_string ( $ this -> fromField ) ) { $ this -> fromField = $ this -> scopeModel -> getMeta ( ) -> getField ( $ this -> fromField ) ; } //inverse side of a relation if ( is_string ( $ this -> toField ) ) { $ this -> toField = $ this -> relation -> toModel -> getMeta ( ) -> getField ( $ this -> toField ) ; } else { $ this -> toField = $ this -> relation -> toModel -> getMeta ( ) -> primaryKey ; } return [ $ this -> fromField , $ this -> toField ] ; }
Returns the fields that are used to create a relation.

@author: Eddilbert Macharia (http://eddmash.com)<edd.cowan@gmail.com>

@return Field[]

@throws ValueError
@throws \Eddmash\PowerOrm\Exception\FieldDoesNotExist
Returns the fields that are used to create a relation .