_a['table'] = 'idf_issuerelations'; $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' => 'related_issues', ), 'verb' => array( 'type' => 'Pluf_DB_Field_Text', 'blank' => false, 'verbose' => __('verb'), ), 'other_issue' => array( 'type' => 'Pluf_DB_Field_Foreignkey', 'model' => 'IDF_Issue', 'blank' => false, 'verbose' => __('other issue'), 'relate_name' => 'related_other_issues', ), 'submitter' => array( 'type' => 'Pluf_DB_Field_Foreignkey', 'model' => 'Pluf_User', 'blank' => false, 'verbose' => __('submitter'), ), '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', ), ); $issuetbl = $this->_con->pfx.'idf_issues'; $this->_a['views'] = array( 'with_other_issue' => array( 'join' => 'INNER JOIN '.$issuetbl.' ON other_issue='.$issuetbl.'.id', 'select' => $this->getSelect().', summary', 'props' => array('summary' => 'other_summary'), )); } function preSave($create=false) { if ($this->id == '') { $this->creation_dtime = gmdate('Y-m-d H:i:s'); } } }