public static function getLatestCommentsbyCompetitorId($competitorId, $limit = 1) { $model = new Default_Model_Comments(); $select = $model->getMapper()->getDbTable()->select()->from(array('comments'), array('id', 'name', 'comment', 'created'))->where('competitorId = ?', $competitorId); $select->where('status = ?', '1'); $select->order('created DESC')->where('NOT deleted'); $select->limit($limit); if ($limit == 1) { $result = $model->fetchRow($select); } else { $result = $model->fetchAll($select); } return $result; }
public function detailsAction() { $id = $this->getRequest()->getParam('id'); if ($id) { $model = new Default_Model_Comments(); /*if($model->find($id)){ $vizualizare = $model->setVizualizare(); }*/ $select = $model->getMapper()->getDbTable()->select()->where('NOT deleted')->where('id=?', $id); $result = $model->fetchRow($select); if ($result) { $this->view->result = $result; } } }