[5.0] Fix CLI Dependencies#6212
[5.0] Fix CLI Dependencies#6212devonzara wants to merge 2 commits intolaravel:masterfrom devonzara:patch-5
Conversation
Automatically instantiate a Request object if it's required. (Useful when running from the CLI where it's would not already be instantiated.) ServiceProviders using objects (eg. URLGenerator) which depend on a Request object were squaking due to receiving NULL instead of a Request object.
There was a problem hiding this comment.
Don't think it going to be enough, mainly because what is there to capture when you're inside a console? It need something similar to how request is resolved in 4.2 (and below).
There was a problem hiding this comment.
Also, you'd need to import this instead of using the fqcn.
There was a problem hiding this comment.
@crynobone The only time Request is not instantiated is when you're inside a console, therefore runningInConsole() would only be redundant.
@GrahamCampbell True, will remove the fqcn...
There was a problem hiding this comment.
I have, it's irrelevant to your point as it used to load every time the application was loaded.
See here. The constructor used to instantiate the Request object immediately.
There was a problem hiding this comment.
See
/**
* Set the application request for the console environment.
*
* @return void
*/
public function setRequestForConsoleEnvironment()
{
$url = $this['config']->get('app.url', 'http://localhost');
$parameters = array($url, 'GET', array(), array(), array(), $_SERVER);
$this->refreshRequest(static::onRequest('create', $parameters));
}Now, compare that with Request::capture().
As an example, how would capture() know your root URL?
|
#6216 using bootstrap approach specifically for console kernel. |
Automatically instantiate a Request object if it's required. (Useful when running from the CLI where it would not already be instantiated.)
ServiceProviders using objects (eg. URLGenerator) which depend on a Request object were squaking due to receiving NULL instead of a Request object.
See here.