3 * @class ApplicationController
5 class ApplicationController {
6 public $request, $id, $params;
10 * Dispatch request to appropriate controller-action by convention according to the HTTP method.
12 public function dispatch($request) {
13 $this->request = $request;
14 $this->id = $request->id;
15 $this->params = $request->params;
17 if ($request->isRestful()) {
18 return $this->dispatchRestful();
20 if ($request->action) {
21 return $this->{$request->action}();
24 // normal dispatch here. discover action
27 protected function dispatchRestful() {
28 switch ($this->request->method) {
33 return $this->create();
36 return $this->update();
39 return $this->destroy();