Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update View.php #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Update View.php #20

wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Jul 11, 2016

This way you can shorten calls to controller based methods, for example: $this->request->uri() for $this->controller->request->uri()

This way you can shorten calls to controller based methods, for example: $this->request->uri() for $this->controller->request->uri()
Of course, forgot to also load models dynamically!
@OmarElgabry
Copy link
Owner

OmarElgabry commented Oct 17, 2016

Instead, you can pass the request and response objects whenever you create a View instance(the same thing we do with controller class).

public function __construct(Controller $controller, Request $request = null, Response $response = null){
        $this->controller    = $controller;
        $this->request       =  $request  !== null ? $request  : new Request();
        $this->response      =  $response !== null ? $response : new Response();
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants