Commit Graph

5 Commits

Author SHA1 Message Date
Bharat Mediratta
5638fc5fb6 Change the way that we do RESTful routing.
1) We now use __call() in REST_Controller to handle any requests to a controller
   that were not already handled.  In the case of RESTful controllers, this should
   be the only entry point (although they're free to break the model and add other
   ones.. nothing stops them).

   This means that we can remove all the catch-all routes in
   routes.php which greatly simplifies it.

2) Move request_method() and output_format() out of REST_Controller and into the REST
   helper in core/helpers/rest.php

3) Experiment with letting the various subclasses check the output_format and deal with
   it themselves.  This simplifies the API, but it might be a bad idea in that it might
   push too much work to the individual controllers.  It's a balancing act, time will tell,
   I'm willing to change it back later.
2008-11-19 04:20:35 +00:00
Jozef Selesi
1992343c2e * Changed REST API. Now there are two separate methods for forms:
GET /form/edit/{controller}/{resource_id} -> controller::_form_edit($resource)
  GET /form/add/{controller}/{parameters}   -> controller::_form_add($parameters)
* Updated comment, user and core modules to reflect the API changes
* Cleaned up routing and handling of requests to /{controller}
2008-11-18 23:40:47 +00:00
Jozef Selesi
b63ea2cdbf - All comments of an item can now be seen /comments?item_id=
- Return proper Content-Type header for GET /comments requests
- Got rid of the query processing for index() in REST_Controller()
- Small misc fixes
2008-11-18 15:48:08 +00:00
Jozef Selesi
3ebb751cda First iteration of REST controller refactoring. RESTful controllers that refer to collections should now have plural names and there should be only one controller per resource. Updated existing classes that implement REST_Controller. The routing now works like this:
GET    /controller    -> controller::_index()
POST   /controller    -> controller::_create()
GET    /controller/id -> controller::_show()
PUT    /controller/id -> controller::_update()
DELETE /controller/id -> controller::_delete()
GET    /form/edit/controller/resource_id -> controller::_form()
GET    /form/add/controller/data         -> controller::_form()
2008-11-18 08:28:32 +00:00
Bharat Mediratta
59dbd1dc83 Move User_Controller to Users_Controller per jozefs request. 2008-11-18 08:10:14 +00:00