diff --git a/src/Model/CachableModel.php b/src/Model/CachableModel.php index c005deec..394c1637 100644 --- a/src/Model/CachableModel.php +++ b/src/Model/CachableModel.php @@ -71,10 +71,12 @@ public static function clearCached() protected static function databaseIsReady() { // Outside of dev/ don't actually do any checks, assume ready - /** @var HTTPRequest $request */ - $request = Injector::inst()->get(HTTPRequest::class); - if (stripos($request->getURL(false), 'dev/') !== 0) { - return true; + if (Injector::inst()->has(HTTPRequest::class)) { + /** @var HTTPRequest $request */ + $request = Injector::inst()->get(HTTPRequest::class); + if (stripos($request->getURL(false), 'dev/') !== 0) { + return true; + } } $object = DataObject::singleton(static::class);