protected function __setData(stdClass $data) { $this->__setContentFields(); $this->_entity->setVisitorName($data->visitor_name); $this->_entity->setVisitorPhone($data->visitor_phone); $this->_entity->setContent($data->feedback_content); try { $this->_entity->setDatePosted(RM_Date_Datetime::fromString($data->date_posted)); } catch (Exception $e) { throw new Exception('Неверная дата'); } $this->_entity->setShownOnMain((bool) $data->show_on_main); }
public function postFeedbackAction() { $this->_setResponseJSON(); $this->_result->status = 0; if ($this->getRequest()->isPost() && isset($this->_data)) { $data = $this->_data; $feedback = Application_Model_Feedback::create(); try { $feedback->setVisitorName($data->visitor_name); $feedback->setVisitorPhone($data->visitor_phone); $feedback->setContent($data->visitor_feedback); $feedback->setDatePosted(RM_Date_Datetime::now()); $feedback->setProcessed(false); $feedback->save(); $this->_result->status = 1; } catch (Exception $e) { } } }
public function setDatePosted(RM_Date_Datetime $date) { $this->_dataWorker->setValue('datePosted', $date->getSearchDate()); }