/** * After submission ensure the identifiers are hooked up properly. */ protected function postSubmit($isInsert) { $id = $this->submission['fields']['id']['value']; // Get the list of identifiers that should point to this known subject $keys = array(); if (isset($this->submission['metaFields']['identifiers'])) { foreach ($this->submission['metaFields']['identifiers']['value'] as $identifier) { $keys[] = $identifier[0]; } } // do an update query to unlink identifiers that do point to this known subject but shouldn't $this->db->from('identifiers')->set(array('known_subject_id' => null))->where(array('known_subject_id' => $id)); if (count($keys)) { $this->db->notin('id', $keys); } $this->db->update(); // and another updated query to link those that should if (count($keys)) { $this->db->from('identifiers')->set(array('known_subject_id' => $id))->in('id', $keys)->update(); } return parent::postSubmit($isInsert); }
/** * After submission, TODO perhaps? */ protected function postSubmit($isInsert) { kohana::log('debug', 'In Subject_observation_Model::postSubmit() $this->submission is ' . print_r($this->submission, true)); return parent::postSubmit($isInsert); }