| @@ 65-78 (lines=14) @@ | ||
| 62 | * |
|
| 63 | * @throws IOException |
|
| 64 | */ |
|
| 65 | public function save() { |
|
| 66 | if ($this->id > 0) { |
|
| 67 | return update_annotation($this->id, $this->name, $this->value, $this->value_type, |
|
| 68 | $this->owner_guid, $this->access_id); |
|
| 69 | } else { |
|
| 70 | $this->id = create_annotation($this->entity_guid, $this->name, $this->value, |
|
| 71 | $this->value_type, $this->owner_guid, $this->access_id); |
|
| 72 | ||
| 73 | if (!$this->id) { |
|
| 74 | throw new \IOException("Unable to save new " . get_class()); |
|
| 75 | } |
|
| 76 | return $this->id; |
|
| 77 | } |
|
| 78 | } |
|
| 79 | ||
| 80 | /** |
|
| 81 | * Delete the annotation. |
|
| @@ 80-93 (lines=14) @@ | ||
| 77 | * |
|
| 78 | * @throws IOException |
|
| 79 | */ |
|
| 80 | public function save() { |
|
| 81 | if ($this->id > 0) { |
|
| 82 | return update_metadata($this->id, $this->name, $this->value, |
|
| 83 | $this->value_type, $this->owner_guid, $this->access_id); |
|
| 84 | } else { |
|
| 85 | $this->id = create_metadata($this->entity_guid, $this->name, $this->value, |
|
| 86 | $this->value_type, $this->owner_guid, $this->access_id); |
|
| 87 | ||
| 88 | if (!$this->id) { |
|
| 89 | throw new \IOException("Unable to save new " . get_class()); |
|
| 90 | } |
|
| 91 | return $this->id; |
|
| 92 | } |
|
| 93 | } |
|
| 94 | ||
| 95 | /** |
|
| 96 | * Delete the metadata |
|