I have a controller that extends Zend_Controller_Action. It contains some actions that I need to give people access to via a RESTful MVC web service.

I've seen some articles that have told me to extend using a different class (Zend_Rest_Controller) but this seems to mean I need to override certain abstract methods and really I no use for most of them (I have my own functions that are quite specific!).

I've seen some code that I've meant to copy into my bootstrap.php and makes use of the FrontController. However, everything I've seen is awfully documented.

Can anybody give me an example that will just work for a controller called, say 'catalog' that contains two actions 'getRoot' and 'checkLatest'? (It should be simple yet I can't get anything to work and have a deadline tomorrow!)

Or else, perhaps point me in the right direction... (I've no idea how to troubleshoot this and see, for example, what URL I should be using to test or where the route I have setup is directing this... I've been looking at this, btw: http://techchorus.net/create-restful-applications-using-zend-framework)

Thanks a lot! :)

Comments

This might be of an interest to you: weierophinney.net/matthew/archives/…

Written by Richard Knop

How about this article slideshare.net/weierophinney/…

Written by jakenoble

Accepted Answer

In the article that you mention you have a class:

class ArticleController extends Zend_Rest_Controller

Just like that example you should create a CatalogController. The different methods that you require should be sent as parameters HTTP GET parameters. The getAction should perform the operations (depending on your request) and return a collection of of results in the response depending on different possibilities such as "getRoot" or "checkLatest" as you mention.

Written by Armand
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki