Silverstripe Version: 4.2
I have a custom AssetAdapter
that makes some changes to the filesystem based on the current request. I am using injector to get the request:
$request = Injector::inst()->get(HTTPRequest::class);
For the most part this works fine, but in a couple of isolated instances, I get the error:
ERROR [Emergency]: Uncaught ArgumentCountError: Too few arguments to function SilverStripe\Control\HTTPRequest::__construct(), 0 passed and at least 2 expected
IN GET /ecms-client/public/markseen
Line 157 in /project/path/vendor/silverstripe/framework/src/Control/HTTPRequest.php
This appears to be an issue/conflict with GraphQL and Assets (GraphQL doesn't always seem to have the current request available). I was wondering if there was a way to check if the current HTTPRequest is available/setup before trying to get it via Injector
?