/** * Save the relationship * * @return int the relationship id */ public function save() { if ($this->id > 0) { delete_relationship($this->id); } $this->id = add_entity_relationship($this->guid_one, $this->relationship, $this->guid_two); if (!$this->id) { throw new IOException(sprintf(elgg_new('IOException:UnableToSaveNew'), get_class())); } return $this->id; }
/** * Save this instance * * @return int an object id */ function save() { if ($this->id > 0) { return update_annotation($this->id, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id); } else { $this->id = create_annotation($this->entity_guid, $this->name, $this->value, $this->value_type, $this->owner_guid, $this->access_id); if (!$this->id) { throw new IOException(sprintf(elgg_new('IOException:UnableToSaveNew'), get_class())); } return $this->id; } }