Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
Use createObject for DI
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Kelty committed Apr 16, 2021
1 parent d1103d6 commit 8888448
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function getGlobals()
{
return [
'upper' => [
'cache' => new CacheResponse(\Craft::$app->getResponse())
'cache' => \Craft::createObject(CacheResponse::class, [\Craft::$app->getResponse()]),
]
];
}
Expand Down

1 comment on commit 8888448

@ostark
Copy link
Owner

@ostark ostark commented on 8888448 Apr 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timkelty You are right, auto constructor injection does not work, since the Response is registered as response coupled "component" and not loosely as\craft\web\Response
https://github.com/craftcms/cms/blob/develop/src/config/app.web.php#L17

Please sign in to comment.