_a['table'] = 'idf_issuecomments'; $this->_a['model'] = __CLASS__; $this->_a['cols'] = array( // It is mandatory to have an "id" column. 'id' => array( 'type' => 'Pluf_DB_Field_Sequence', 'blank' => true, ), 'issue' => array( 'type' => 'Pluf_DB_Field_Foreignkey', 'model' => 'IDF_Issue', 'blank' => false, 'verbose' => __('issue'), 'relate_name' => 'comments', ), 'content' => array( 'type' => 'Pluf_DB_Field_Text', 'blank' => false, 'verbose' => __('comment'), ), 'submitter' => array( 'type' => 'Pluf_DB_Field_Foreignkey', 'model' => 'Pluf_User', 'blank' => false, 'verbose' => __('submitter'), 'relate_name' => 'commented_issue', ), 'changes' => array( 'type' => 'Pluf_DB_Field_Serialized', 'blank' => true, 'verbose' => __('changes'), 'help_text' => __('Serialized array of the changes in the issue.'), ), 'creation_dtime' => array( 'type' => 'Pluf_DB_Field_Datetime', 'blank' => true, 'verbose' => __('creation date'), ), ); $this->_a['idx'] = array( 'creation_dtime_idx' => array( 'col' => 'creation_dtime', 'type' => 'normal', ), ); } function changedIssue() { return count($this->changes) > 0; } function _toIndex() { return $this->content; } function preSave() { if ($this->id == '') { $this->creation_dtime = gmdate('Y-m-d H:i:s'); } } function postSave() { // This will be used to fire the indexing or send a // notification email to the interested people, etc. $q = new Pluf_Queue(); $q->model_class = __CLASS__; $q->model_id = $this->id; $q->action = 'updated'; $q->lock = 0; $q->create(); } }