/** * Tests if this object has a relationship to a different model. * * @param object related ORM model * @param boolean check for any relations to given model * @return boolean */ public function has(CORM $model, $any = FALSE) { $id_set = $this->get_relations($model->object_plural); if (!$model->empty_primary_key()) { return in_array($model->primary_key_value, $id_set); } else { return !empty($id_set); } }