public function save($throwIfInvalid = true) { //check to see if the triple already exists, from the same user if (empty($this->user_id)) { $currentUser = current_user(); $this->user_id = $currentUser->id; } $count = $this->getTable()->count(array('subject_id' => $this->subject_id, 'object_id' => $this->object_id, 'user_id' => $this->user_id, 'subject_record_type' => $this->subject_record_type, 'object_record_type' => $this->object_record_type, 'property_id' => $this->property_id)); if ($count == 0) { parent::save(); } }