/** * Insert new comment in table and return active record object * @return CommentPost */ public function buildRecord() { $record = new CommentPost(); $record->pathway = $this->pathway; $record->user_id = $this->_userId; $record->guest_name = $this->guestName; $record->message = $this->message; $record->lang = App::$Request->getLanguage(); // check if premoderation is enabled and user is guest if ((int) $this->_configs['guestModerate'] === 1 && $this->_userId < 1) { $record->moderate = 1; } $record->save(); return $record; }
/** * Save updated data to database */ public function make() { $this->_record->message = $this->message; $this->_record->guest_name = $this->guestName; $this->_record->save(); }