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}();
25 protected function dispatchRestful() {
26 switch ($this->request->method) {
31 return $this->create();
34 return $this->update();
37 return $this->destroy();