hettiger / larapress

A Laravel 4 CMS – WARNING: This project is no longer being developed because there are many good alternatives now.
MIT License
154 stars 26 forks source link

Injecting Request – Maybe a bug? #33

Closed hettiger closed 10 years ago

hettiger commented 10 years ago

Can anyone confirm this is a bug?

PHP Analyzer says: You have injected the Request via parameter $request. This is generally not recommended as there might be multiple instances during a request cycle (f.e. when using sub-requests). Instead, it is recommended to inject the RequestStack and retrieve the current request each time you need it via getCurrentRequest().

I think it is not and if I follow the Laravel docs this should be the correct way of doing it?

Here's the ServiceProvider that is creating the instance.

hettiger commented 10 years ago

Had a discussion on IRC with some #laravel moderator about this:

<$mod> the requeststack is a symfony concept not used by laravel

<_hettiger> ah okay so i guess it's fine doing it that way :-) <$mod> hettiger: under doubt - laravel is not designed at all to handle multiple request instances

($mod is not his actual IRC nick as I don't think he'd want to be mentioned by name here)