public function relation($name)
    {
        if (isset($this->_relationships[$name])) {
            return $this->_relationships[$name];
        }
        if (!isset($this->_relations[$name])) {
            throw new ORMException("Relationship `{$name}` not found.");
        }
        $config = $this->_relations[$name];
        $relationship = $config['relation'];
        unset($config['relation']);

        $relation = $this->_classes[$relationship];
        return $this->_relationships[$name] = new $relation($config + [
            'name'        => $name,
            'conventions' => $this->_conventions
        ]);
    }
public function relation($name)
    {
        if (isset($this->_relationships[$name])) {
            return $this->_relationships[$name];
        }
        if (!isset($this->_relations[$name])) {
            throw new ORMException("Relationship `{$name}` not found.");
        }
        $config = $this->_relations[$name];
        $relationship = $config['relation'];
        unset($config['relation']);

        $relation = $this->_classes[$relationship];
        return $this->_relationships[$name] = new $relation($config + [
            'name'        => $name,
            'conventions' => $this->_conventions
        ]);
    }
public function relation ( $ name ) { if ( isset ( $ this -> _relationships [ $ name ] ) ) { return $ this -> _relationships [ $ name ] ; } if ( ! isset ( $ this -> _relations [ $ name ] ) ) { throw new ORMException ( "Relationship `{$name}` not found." ) ; } $ config = $ this -> _relations [ $ name ] ; $ relationship = $ config [ 'relation' ] ; unset ( $ config [ 'relation' ] ) ; $ relation = $ this -> _classes [ $ relationship ] ; return $ this -> _relationships [ $ name ] = new $ relation ( $ config + [ 'name' => $ name , 'conventions' => $ this -> _conventions ] ) ; }
Returns a relationship instance.

@param  string $name The name of a relation.
@return object       Returns a relationship intance or `null` if it doesn't exists.
Returns a relationship instance .