source/Spiral/ORM/Entities/RelationMap.php
public function get(string $relation): RelationInterface
    {
        if (isset($this->relations[$relation]) && $this->relations[$relation] instanceof RelationInterface) {
            return $this->relations[$relation];
        }

        $instance = $this->orm->makeRelation($this->class, $relation);
        if (array_key_exists($relation, $this->relations)) {
            //Indicating that relation is loaded
            $instance = $instance->withContext($this->parent, true, $this->relations[$relation]);
        } else {
            //Not loaded relation
            $instance = $instance->withContext($this->parent, false);
        }

        return $this->relations[$relation] = $instance;
    }
public function get(string $relation): RelationInterface
    {
        if (isset($this->relations[$relation]) && $this->relations[$relation] instanceof RelationInterface) {
            return $this->relations[$relation];
        }

        $instance = $this->orm->makeRelation($this->class, $relation);
        if (array_key_exists($relation, $this->relations)) {
            //Indicating that relation is loaded
            $instance = $instance->withContext($this->parent, true, $this->relations[$relation]);
        } else {
            //Not loaded relation
            $instance = $instance->withContext($this->parent, false);
        }

        return $this->relations[$relation] = $instance;
    }
public function get ( string $ relation ) : RelationInterface { if ( isset ( $ this -> relations [ $ relation ] ) && $ this -> relations [ $ relation ] instanceof RelationInterface ) { return $ this -> relations [ $ relation ] ; } $ instance = $ this -> orm -> makeRelation ( $ this -> class , $ relation ) ; if ( array_key_exists ( $ relation , $ this -> relations ) ) { //Indicating that relation is loaded $ instance = $ instance -> withContext ( $ this -> parent , true , $ this -> relations [ $ relation ] ) ; } else { //Not loaded relation $ instance = $ instance -> withContext ( $ this -> parent , false ) ; } return $ this -> relations [ $ relation ] = $ instance ; }
Get associated relation instance.

@param string $relation

@return RelationInterface
Get associated relation instance .