/** * Save data to database */ public function make() { $this->_record->name = $this->name; $this->_record->email = $this->email; $this->_record->message = $this->message; $this->_record->save(); }
/** * @inheritdoc */ public function make() { // update readed marker $this->_post->readed = 1; $this->_post->save(); // add new answer row in database $record = new FeedbackAnswer(); $record->feedback_id = $this->_post->id; $record->name = $this->name; $record->email = $this->email; $record->message = $this->message; $record->user_id = $this->_userId; $record->is_admin = 1; $record->ip = $this->_ip; $record->save(); // add user notification if ((int) $this->_post->user_id > 0 && $this->_userId !== (int) $this->_post->user_id) { $notify = new EntityAddNotification((int) $this->_post->user_id); $uri = '/feedback/read/' . $this->_post->id . '/' . $this->_post->hash . '#feedback-answer-' . $record->id; $notify->add($uri, EntityAddNotification::MSG_ADD_FEEDBACKANSWER, ['snippet' => Text::snippet($this->message, 50), 'post' => Text::snippet($this->_post->message, 50)]); } // send email notification $this->sendEmail($this->_post); // unset message data $this->message = null; }
/** * Add new row to database and set post is unreaded */ public function make() { // update readed marker $this->_post->readed = 0; $this->_post->save(); // add new answer row in database $record = new FeedbackAnswer(); $record->feedback_id = $this->_post->id; $record->name = $this->name; $record->email = $this->email; $record->message = $this->message; if ($this->_userId > 0) { $record->user_id = $this->_userId; } $record->ip = $this->_ip; $record->save(); // add notification msg $targetId = $this->_post->user_id; if ($targetId !== null && (int) $targetId > 0 && $targetId !== $this->_userId) { $notify = new EntityAddNotification($targetId); $uri = '/feedback/read/' . $this->_post->id . '/' . $this->_post->hash . '#feedback-answer-' . $record->id; $notify->add($uri, EntityAddNotification::MSG_ADD_FEEDBACKANSWER, ['snippet' => Text::snippet($this->message, 50), 'post' => Text::snippet($this->_post->message, 50)]); } }