Closed jmfeurprier closed 7 years ago
I guess adding an empty()
check on the return value of $this->requestStack->getMasterRequest()
in src/RequestAwareRestClient.php
, method mergeDefaultParameters()
, should fix the issue.
Actual code:
/**
* {@inheritdoc}
*/
protected function mergeDefaultParameters(array $parameters)
{
$parameters = parent::mergeDefaultParameters($parameters);
$language = $this->requestStack->getMasterRequest()->headers->get('Accept-Language');
$parameters['headers'] = isset($parameters['headers']) ? $parameters['headers'] : [];
$parameters['headers'] = array_merge($parameters['headers'], ['Accept-Language' => $language]);
return $parameters;
}
LGTM, can you make a PR of it ?
Sure, will do !
PR #10 is ready.
Fixed by #10
Hi,
we are using the SDK Bundle in a Symfony 3 application.
Everything works fine when used in a HTTP context (Controller => Manager => EntityRepo => SDK).
When we use the SDK in a CLI context (Command => Manager => ...), things go bad as there is no request/request stack available:
Is there a way to configure the bundle to work with commands?