Skip to content
Snippets Groups Projects

Pluggable restful

Merged Patrick Barroca requested to merge pluggable-restful into master
Compare and
+ 211
106
Preferences
Compare changes
Files
@@ -23,74 +23,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
@@ -23,74 +23,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
*/
*/
class IndexController extends Zend_Controller_Action {
class IndexController extends Restful_Controller {
protected $_model;
public function init() {
$this->_helper
->getHelper('contextSwitch')
->addActionContext('catalog', 'json')
->initContext();
}
public function preDispatch() {
$this->_model = Restful_Model::newFor($this->_getParam('model'));
}
public function catalogAction() {
$this->view->models = Restful_Model_Configuration::getAll();
}
public function indexAction() {
if ($this->_request->isPost())
return $this->_forward('create');
$params = $this->_request->getParams();
unset($params['model']);
$page = $this->_getParam('page', 1);
unset($params['page']);
$this->_helper->json($this->_model->index($page, $params), true);
}
public function showAction() {
if ($this->_request->isPut())
return $this->_forward('update');
if ($this->_request->isDelete())
return $this->_forward('delete');
$this->_helper->json($this->_model->show((int) $this->_getParam('id')),
true);
}
public function editAction() {
$this->_helper->json($this->_model->show((int) $this->_getParam('id')),
true);
}
public function newAction() {
$this->render('index');
}
public function createAction() {
}
public function updateAction() {
}
public function deleteAction() {
}
}
}
\ No newline at end of file