/** * Pobranie szablonów dla Użytkownika * @return type */ protected function _getTemplate() { $model = new WsTemplate(); $select = $model->select()->from('ws.template', array(new Zend_Db_Expr('DISTINCT ON (template_name) template.*')))->where('ghost IS FALSE')->where('(created_by = ?', Zend_Auth::getInstance()->getIdentity()->id)->orWhere('ws_client_id = ?)', $this->_client->id)->order(array('template_name', 'version_num DESC')); return $model->fetchAll($select); }