protected function fetchRelation(array $relation)
    {
        /* a relation is of the form
         * [$type, $foreign_class, $foreign_column, $column]
         */
        list($type, $foreign_class, $foreign_column, $column) = $relation;

        switch ($type) {
        case 'has_one':
            return $this->fetchOneToOne($foreign_class, $foreign_column, $column);
        case 'belongs_to':
            return $this->fetchOneToOne($foreign_class, $foreign_column, $column);
        case 'has_many':
            return $this->fetchOneToMany($foreign_class, $foreign_column, $column);
        default:
        }
    }
protected function fetchRelation(array $relation)
    {
        /* a relation is of the form
         * [$type, $foreign_class, $foreign_column, $column]
         */
        list($type, $foreign_class, $foreign_column, $column) = $relation;

        switch ($type) {
        case 'has_one':
            return $this->fetchOneToOne($foreign_class, $foreign_column, $column);
        case 'belongs_to':
            return $this->fetchOneToOne($foreign_class, $foreign_column, $column);
        case 'has_many':
            return $this->fetchOneToMany($foreign_class, $foreign_column, $column);
        default:
        }
    }
protected function fetchRelation ( array $ relation ) { /* a relation is of the form
         * [$type, $foreign_class, $foreign_column, $column]
         */ list ( $ type , $ foreign_class , $ foreign_column , $ column ) = $ relation ; switch ( $ type ) { case 'has_one' : return $ this -> fetchOneToOne ( $ foreign_class , $ foreign_column , $ column ) ; case 'belongs_to' : return $ this -> fetchOneToOne ( $ foreign_class , $ foreign_column , $ column ) ; case 'has_many' : return $ this -> fetchOneToMany ( $ foreign_class , $ foreign_column , $ column ) ; default : } }
Fetch a related entity from the database.

@param array $relation The relation to fetch.
Fetch a related entity from the database .