Controller should have access to Request object

Bug #340583 reported by Anthony Bush on 2009-03-10
2
Affects Status Importance Assigned to Milestone
LightVC
Undecided
Unassigned

Bug Description

Pass the request object to the controller, and add methods to it for things like:

    isSecure() { return isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on'; }
    isPost() { ... }
    isGet() { ... }
    isPut() { ... }
    isDelete() { ... }
    isHead() { ... }
    isOptions() { ... }
    etc.

Also, move/copy "get" data into "query" -- in other words, PHP puts the query data into the GET superglobal even when the request is not a GET, e.g.:

    <form action="?some_var=some_value" method="post">...</form>

Make sure LightVC is more clear about them. An action handling a POST request should be able to use:

    $request = $this->getRequest();
    $request->isPost();
    $request->getPost(); // either $_POST or $this->post which combines the _FILES array...
    $request->getQuery(); // array('some_var' => 'some_value');
    $request->getGet(); // blank if not a get request, but for legacy code we'll leave `$this->get` as is.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers