/** * Given two beans this function returns TRUE if they are associated using a * many-to-many association, FALSE otherwise. * * @throws RedBean_Exception_SQL * * @param RedBean_OODBBean $bean1 bean * @param RedBean_OODBBean $bean2 bean * * @return boolean */ public function areRelated(RedBean_OODBBean $bean1, RedBean_OODBBean $bean2) { try { $row = $this->writer->queryRecordLink($bean1->getMeta('type'), $bean2->getMeta('type'), $bean1->id, $bean2->id); return (bool) $row; } catch (RedBean_Exception_SQL $exception) { $this->handleException($exception); return FALSE; } }