src/Relationship/BelongsToRelationship.php
public function get()
    {
        $parent = $this->child->getParent();

        if ($parent) {
            return $parent;
        }

        $parentClass = $this->parentClass;

        $parentId = $this->child->getParentId();

        $innerHits = $this->child->getInnerHits();

        if ($innerHits) {
            $attributes = $innerHits->getParent($parentClass::getType());
            $parent = new $parentClass($attributes);
        } elseif ($parentId) {
            $parent = $parentClass::find($parentId);
        }

        if ($parent) {
            $this->child->setParent($parent);
        }

        return $parent;
    }
public function get()
    {
        $parent = $this->child->getParent();

        if ($parent) {
            return $parent;
        }

        $parentClass = $this->parentClass;

        $parentId = $this->child->getParentId();

        $innerHits = $this->child->getInnerHits();

        if ($innerHits) {
            $attributes = $innerHits->getParent($parentClass::getType());
            $parent = new $parentClass($attributes);
        } elseif ($parentId) {
            $parent = $parentClass::find($parentId);
        }

        if ($parent) {
            $this->child->setParent($parent);
        }

        return $parent;
    }
public function get ( ) { $ parent = $ this -> child -> getParent ( ) ; if ( $ parent ) { return $ parent ; } $ parentClass = $ this -> parentClass ; $ parentId = $ this -> child -> getParentId ( ) ; $ innerHits = $ this -> child -> getInnerHits ( ) ; if ( $ innerHits ) { $ attributes = $ innerHits -> getParent ( $ parentClass :: getType ( ) ) ; $ parent = new $ parentClass ( $ attributes ) ; } elseif ( $ parentId ) { $ parent = $ parentClass :: find ( $ parentId ) ; } if ( $ parent ) { $ this -> child -> setParent ( $ parent ) ; } return $ parent ; }
Return parent model.

@return ElasticsearchModel|null
Return parent model .