diff --git a/skeleton/meta/definitions/storage.php b/skeleton/meta/definitions/storage.php index 8b485dc..d33a130 100644 --- a/skeleton/meta/definitions/storage.php +++ b/skeleton/meta/definitions/storage.php @@ -16,10 +16,4 @@ return [ return $adapter; }, - - AdapterProxy::class => function (ContainerInterface $c) { - return new AdapterProxy( - $c->get(ConnectionAdapter::class) - ); - }, ]; diff --git a/src/ControllerTrait.php b/src/ControllerTrait.php index 0a9fbd2..4b90d2a 100644 --- a/src/ControllerTrait.php +++ b/src/ControllerTrait.php @@ -2,6 +2,7 @@ namespace Lean; +use DI\Attribute\Inject; use Lean\Factory\HttpFactory; use Notes\Attribute\Ignore; use Notes\Route\Attribute\Object\Route; @@ -18,15 +19,21 @@ use function file_get_contents; #[Security(locked: false, realm: "Protected Area")] #[Route(method: [ "GET", "POST" ])] trait ControllerTrait { - public ? \Notes\Breadcrumb\Breadcrumb $breadcrumb; - public ? Session $session; + #[Inject] + public \Notes\Breadcrumb\Breadcrumb $breadcrumb; - public ? Cookie $cookie; + #[Inject] + public Session $session; - public ? Picea\Picea $picea; + #[Inject] + public Cookie $cookie; - public ? MailerInterface $mailer; + #[Inject] + public Picea\Picea $picea; + + #[Inject] + public MailerInterface $mailer; public array $contextList = []; diff --git a/src/Kernel.php b/src/Kernel.php index f2bc02d..e427592 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -106,6 +106,8 @@ class Kernel { { $containerBuilder = new ContainerBuilder(); + $containerBuilder->useAttributes(true); + if (getenv("APP_ENV") === "prod") { if (getenv("CACHE_PATH")) { # check if ACPU is there first, $containerBuilder->enableDefinitionCache();