0

When I extend a class from Zend_Rest_Controller , the 5 abstract method is implemented (index , get , put , delete , post ) , Which is used for CRUD .

my project structure is

 -application
     - config
     - controllers       // used for our web controllers
     - emails
     - forms
     - views
     -Bootstrap.php
-library
  -CustomLibrary // Libraries for our project
  -Frontend
   -Action.php //this is extends Zend_Action_Controller and I added some customize code

I want to make a web service for my application to use it on our Android Application , I want to return for Android application JSON Objects and params. I researched and asked over stackoverflow and I find Rest Controller is the way to use it. My Questions : Is it right to use the Zend_Rest_Controller for this case ?
- If yes , I cant write more Actions , I use only the abstracted actions , I need more than those actions like (registerAction(), getAllNewsAction() , etc ... ) or shall i use more more classes for that?


If No , What to use ? And where to put those api classes ( in the same controller folder or to put it in Library folder)

KJA
  • 743
  • 3
  • 9
  • 21

1 Answers1

0

If you use an RESTful architecture you have always one of the following GET-, POST-, PUT-, DELETE-actions. Within ZF2 this means you have the following actions implemented in your Controller-Class: indexAction (GET-Request), getAction (GET-Request), postAction (POST-Request)

Your additional needed methods are imo controlled via the parameters you pass to the requests above. Take a look at this tutorial: http://www.techchorus.net/create-restful-applications-using-zend-framework

emolah
  • 227
  • 2
  • 11