As I’m adding functionality to my project, I’ve stumbled across this issue. Response::withRedirect() is defined as follows:
public function withRedirect($url, $status = 302)
{
return $this->withStatus($status)->withHeader('Location', (string)$url);
}
This is all fine and well, but I’d much prefer to use the redirect with route name as it’s target rather than a URL. Is there any way this can be achieved?
BTW, this is done from Controller code, so the variable available to me in this context are:
public function pageEdit (Request $request, Response $response, $args)
so I don’t quite see how to get resolve a route name to a URL based on the available parameters.
I have another question. Why pass 3 arguments in new Bookshelf\BookController($c['view'], $c['router'], $c['flash']); and not all the container with $c like new Bookshelf\BookController($c); and then in the controller you can use what you want? Is performance or what?
Sorry, but I’m not an expert with PHP and with dependency container concept.