- Now using attributes injection based on PHP-DI's documentation suggestion
This commit is contained in:
parent
f462fcc597
commit
212dbd17c0
|
@ -16,10 +16,4 @@ return [
|
||||||
|
|
||||||
return $adapter;
|
return $adapter;
|
||||||
},
|
},
|
||||||
|
|
||||||
AdapterProxy::class => function (ContainerInterface $c) {
|
|
||||||
return new AdapterProxy(
|
|
||||||
$c->get(ConnectionAdapter::class)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace Lean;
|
namespace Lean;
|
||||||
|
|
||||||
|
use DI\Attribute\Inject;
|
||||||
use Lean\Factory\HttpFactory;
|
use Lean\Factory\HttpFactory;
|
||||||
use Notes\Attribute\Ignore;
|
use Notes\Attribute\Ignore;
|
||||||
use Notes\Route\Attribute\Object\Route;
|
use Notes\Route\Attribute\Object\Route;
|
||||||
|
@ -18,15 +19,21 @@ use function file_get_contents;
|
||||||
#[Security(locked: false, realm: "Protected Area")]
|
#[Security(locked: false, realm: "Protected Area")]
|
||||||
#[Route(method: [ "GET", "POST" ])]
|
#[Route(method: [ "GET", "POST" ])]
|
||||||
trait ControllerTrait {
|
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 = [];
|
public array $contextList = [];
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,8 @@ class Kernel {
|
||||||
{
|
{
|
||||||
$containerBuilder = new ContainerBuilder();
|
$containerBuilder = new ContainerBuilder();
|
||||||
|
|
||||||
|
$containerBuilder->useAttributes(true);
|
||||||
|
|
||||||
if (getenv("APP_ENV") === "prod") {
|
if (getenv("APP_ENV") === "prod") {
|
||||||
if (getenv("CACHE_PATH")) {
|
if (getenv("CACHE_PATH")) {
|
||||||
# check if ACPU is there first, $containerBuilder->enableDefinitionCache();
|
# check if ACPU is there first, $containerBuilder->enableDefinitionCache();
|
||||||
|
|
Loading…
Reference in New Issue