public function setProblemListComments(array $comments) { $problemListComments = array(); foreach ($this->problemListComments as $comment) { $problemListComments[$comment->problemListCommentId] = $comment; } $this->problemListComments = array(); foreach ($comments as $comment) { $problemListComment = new ProblemListComment(); $problemListComment->populateWithArray($comment); // we need to populate person // if not populated, this may alter the person entry (don't know why?) $problemListComment->author->populate(); $this->problemListComments[] = $problemListComment; } }
public function ajaxAnnotateAction() { $problemListId = $this->_getParam('problemListId'); $comment = $this->_getParam('comment'); if (strlen($problemListId) <= 0) { throw new Exception(__('Empty Problem List ID')); } $problemListComment = new ProblemListComment(); $problemListComment->problemListId = $problemListId; $problemListComment->setAuthorId((int) Zend_Auth::getInstance()->getIdentity()->personId); // we need to populate person // if not populated, this may alter the person entry (don't know why?) $problemListComment->author->populate(); $problemListComment->date = date('Y-m-d'); $problemListComment->comment = $comment; $problemListComment->persist(); $rows = array('msg' => __('Successfully saved.')); $data = array(); $data['rows'] = $rows; $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct($data); }