Skip to content

[5.0] Fix CLI Dependencies#6212

Closed
devonzara wants to merge 2 commits intolaravel:masterfrom
devonzara:patch-5
Closed

[5.0] Fix CLI Dependencies#6212
devonzara wants to merge 2 commits intolaravel:masterfrom
devonzara:patch-5

Conversation

@devonzara
Copy link
Copy Markdown
Contributor

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.

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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, you'd need to import this instead of using the fqcn.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check 4.2 code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@crynobone
Copy link
Copy Markdown
Member

#6216 using bootstrap approach specifically for console kernel.

@devonzara devonzara closed this Oct 25, 2014
@devonzara devonzara deleted the patch-5 branch October 25, 2014 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants