예제 #1
0
 /**
  *
  * @param type $data
  * @return \NoticeboardInput 
  */
 protected function actionGetByNoticeId($data)
 {
     $inputModel = new NoticeboardInput('GetByNoticeId');
     $inputModel->setAttributes($data);
     $inputModel->format = $this->arrayPull($data, 'format', 'json');
     $this->isValid = $inputModel->validate();
     return $inputModel;
 }
 /**
  *
  * @param \NoticeboardInput $data
  * @return type 
  */
 public function getByNoticeId($data)
 {
     $model = new Noticeboard();
     $model->unsetAttributes();
     $result = $model->findByPk($data->getAttribute('id'));
     $view = $result ? 'bynoticeid/done' : 'bynoticeid/error';
     $params = $result ? array('format' => $data->format, 'data' => $result->attributes) : array('format' => $data->format);
     $body = $this->renderPartial($view, $params, true);
     return $this->response->goodResponse($body);
 }