added HTTP method dependent action (REST pattern)

This commit is contained in:
Steffen Vogel 2010-07-22 12:08:01 +02:00
parent 8bb22e5697
commit d71dccbcf3
2 changed files with 3 additions and 3 deletions

View file

@ -114,7 +114,7 @@ class Dispatcher {
* execute application
*/
public function run() {
$action = ($this->view->request->getParameter('action')) ? 'get' : $this->view->request->getParameter('action'); // default action
$action = ($this->view->request->getParameter('action')) ? strtolower($this->view->request->getMethod()) : $this->view->request->getParameter('action'); // default action
$this->controller->run($action); // run controllers actions (usually CRUD: http://de.wikipedia.org/wiki/CRUD)

View file

@ -39,7 +39,7 @@ class Request {
*
* @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
*/
public $method;
protected $method;
/**
* constructor
@ -63,7 +63,7 @@ class Request {
* setter & getter
*/
public function getHeader($header) { return $this->headers[$header]; }
public function getMethod() { return $this->method; };
public function getParameter($name, $method = 'get') {
return (isset($this->parameters[$method][$name])) ? $this->parameters[$method][$name] : NULL;
}