id; return $this->get_all($filters, $orderby, $desc, array('thread' => $thread), $limit); } /** * @param Thread_comment $thread_comment * @param $data * @throws \Exception */ public function initial_save(Entity $thread_comment, $data) { try { $this->beginTransaction(); if ($data['fn'] == 'comment_add' || $data['fn'] == 'thread_close' || $data['content'] != '') { parent::initial_save($thread_comment, $data); $thread_comment->thread->set_participant_flags($thread_comment->author, array('subscribent', 'commentator')); } if ($data['fn'] == 'thread_close') { $thread_comment->thread->set_state('closed'); } elseif ($data['fn'] == 'thread_reject') { $thread_comment->thread->set_state('rejected'); } elseif ($data['fn'] == 'thread_reopen') { $thread_comment->thread->set_state('opened'); } $thread_comment->thread->update_last_activity(); $this->commitTransaction(); } catch(Exception $exception) { $this->rollbackTransaction(); } $thread_comment->mail_notify_add(); } public function update_save(Entity $thread_comment, $data) { try { $this->beginTransaction(); parent::update_save($thread_comment, $data); $thread_comment->thread->update_last_activity(); $this->commitTransaction(); } catch(Exception $exception) { $this->rollbackTransaction(); } } public function delete(Entity $obj) { try { $this->beginTransaction(); parent::delete($obj); $obj->thread->update_last_activity(); $this->commitTransaction(); } catch(Exception $exception) { $this->rollbackTransaction(); } } }