I have a service, which requires to get some information from the request.
I do not want to pass those values to the service all the time, so is it possible, that the service gets some information about the request and especially the cookies by himself?
class SomeService {
public function someMethod() {
// access request and cookies, whithout passing in those values
}
}
inject the
requestservice then.You surely have a service definition, modify it like this:
Then in your class, create a __construct method that will receive the request object: