- 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; | ||||
|     }, | ||||
| 
 | ||||
|     AdapterProxy::class => function (ContainerInterface $c) { | ||||
|         return new AdapterProxy( | ||||
|             $c->get(ConnectionAdapter::class) | ||||
|         ); | ||||
|     }, | ||||
| ]; | ||||
|  | ||||
| @ -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();
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user