value pairs of fields to save on the relationship * @return boolean true if successful */ public function add($lhs, $rhs, $additionalFields = array()) { $dataToInsert = $this->getRowToInsert($lhs, $rhs, $additionalFields); //If the current data matches the existing data, don't do anything if (!$this->checkExisting($dataToInsert)) { $lhsLinkName = $this->lhsLink; $rhsLinkName = $this->rhsLink; //In a one to one, any existing links from boths sides must be removed first. //one2Many will take care of the right side, so we'll do the left. $lhs->load_relationship($lhsLinkName); $this->removeAll($lhs->$lhsLinkName); $rhs->load_relationship($rhsLinkName); $this->removeAll($rhs->$rhsLinkName); parent::add($lhs, $rhs, $additionalFields); } } }