- Now using attributes injection based on PHP-DI's documentation suggestion
This commit is contained in:
1 parent
f462fcc597
commit
212dbd17c0
3 files changed
+14
-11
No files matched your search
+12
-5
@@ -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 = [];
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user