示例#1
0
 /**
  * Marks the relationship delted for this given record pair.
  *
  * @param string $id         id of the Parent/Focus SugarBean
  * @param string $related_id id or SugarBean to unrelate. Pass a SugarBean if you have it.
  *
  * @return boolean          true if delete was successful or false if it was not
  */
 function delete($id, $related_id = '')
 {
     if (empty($this->focus->id)) {
         $this->focus = BeanFactory::getBean($this->focus->module_name, $id);
     }
     if (!empty($related_id)) {
         if (!$related_id instanceof SugarBean) {
             $related_id = $this->getRelatedBean($related_id);
         }
         if ($this->getSide() == REL_LHS) {
             return $this->relationship->remove($this->focus, $related_id);
         } else {
             return $this->relationship->remove($related_id, $this->focus);
         }
     } else {
         return $this->relationship->removeAll($this);
     }
 }