public function getAllEdges() { $criteria = new CDbCriteria(array('condition' => '(t.source=' . $this->id . ') or (t.target=' . $this->id . ')')); $model = Edge::model(); $model->getDbCriteria()->mergeWith($criteria); return $model->with('target_node', 'source_node')->findAll(); }