- Various fixes bugs and missing code in project's skeleton
This commit is contained in:
		
							parent
							
								
									7a48d707e0
								
							
						
					
					
						commit
						dc52c88c03
					
				| @ -5,6 +5,15 @@ | ||||
|     "week": "week" | ||||
|   }, | ||||
| 
 | ||||
|   "interval": { | ||||
|     "years": "{$years} year(s)", | ||||
|     "months": "{$months} month(s)", | ||||
|     "days": "{$days} day(s)", | ||||
|     "hours": "{$hours} hour(s)", | ||||
|     "minutes": "{$minutes} minutes(s)", | ||||
|     "seconds": "{$seconds} second(s)" | ||||
|   }, | ||||
| 
 | ||||
|   "month": { | ||||
|     "list": [ | ||||
|       "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "Décember" | ||||
|  | ||||
| @ -4,6 +4,15 @@ | ||||
|     "week": "semaine" | ||||
|   }, | ||||
| 
 | ||||
|   "interval": { | ||||
|     "years": "{$years} années(s)", | ||||
|     "months": "{$months} mois", | ||||
|     "days": "{$days} jour(s)", | ||||
|     "hours": "{$hours} heure(s)", | ||||
|     "minutes": "{$minutes} minutes(s)", | ||||
|     "seconds": "{$seconds} seconde(s)" | ||||
|   }, | ||||
| 
 | ||||
|   "month": { | ||||
|     "list": [ | ||||
|       "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre" | ||||
|  | ||||
| @ -7,6 +7,10 @@ use function DI\{ autowire, add, create, get }; | ||||
| $dir = dirname(__DIR__, 2); | ||||
| 
 | ||||
| return [ | ||||
|     \%NAMESPACE%\Factory\FormFactoryInterface::class => autowire(Factory\FormFactory::class), | ||||
|     \Lean\Api\Factory\MessageFactoryInterface::class => autowire(\%NAMESPACE%\Lib\Message::class), | ||||
| 
 | ||||
| 
 | ||||
|     '%APPKEY%' => [ | ||||
|         'picea' => [ | ||||
|             'context' => "%ESCAPED_NAMESPACE%\\View", | ||||
|  | ||||
							
								
								
									
										46
									
								
								skeleton/src/Factory/FormFactory.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								skeleton/src/Factory/FormFactory.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,46 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace %NAMESPACE%\Factory; | ||||
| 
 | ||||
| use Lean\Api\Factory\MessageFactoryInterface; | ||||
| use Lean\LanguageHandler; | ||||
| use Picea\Ui\Method\FormContextInterface; | ||||
| use Picea\Ui\Method\FormInterface; | ||||
| use Psr\Http\Message\ServerRequestInterface; | ||||
| use Storage\Session; | ||||
| use Ulmus\Entity\EntityInterface; | ||||
| use Ulmus\User\Entity\UserInterface; | ||||
| use Ulmus\User\Lib\Authenticate; | ||||
| 
 | ||||
| class FormFactory implements FormFactoryInterface | ||||
| { | ||||
|  /* | ||||
|     public function __construct( | ||||
|         protected ServerRequestInterface $request, | ||||
|         protected Authenticate $authenticate, | ||||
|         protected Session $session, | ||||
|         protected LanguageHandler $languageHandler, | ||||
|         protected MessageFactoryInterface $messageFactory, | ||||
|     ) {} | ||||
| 
 | ||||
|     public function save(EntityInterface $entity): FormInterface | ||||
|     { | ||||
|         return new Form\Save($this->languageHandler, $this->messageFactory, $entity); | ||||
|     } | ||||
| 
 | ||||
|     public function saveContext(? ServerRequestInterface $request = null, ? string $formName = null): FormContextInterface | ||||
|     { | ||||
|         return new Form\SaveContext($request ?: $this->request, $formName); | ||||
|     } | ||||
| 
 | ||||
|     public function delete(EntityInterface $entity): FormInterface | ||||
|     { | ||||
|         return new Form\Delete($this->languageHandler, $this->messageFactory, $entity); | ||||
|     } | ||||
| 
 | ||||
|     public function deleteContext(?ServerRequestInterface $request = null, ?string $formName = null): FormContextInterface | ||||
|     { | ||||
|         return new Lib\FormContext($request, $formName); | ||||
|     } | ||||
|  */ | ||||
| } | ||||
							
								
								
									
										25
									
								
								skeleton/src/Factory/FormFactoryInterface.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								skeleton/src/Factory/FormFactoryInterface.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,25 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace %NAMESPACE%\Factory; | ||||
| 
 | ||||
| use Lean\Api\Factory\MessageFactoryInterface; | ||||
| use Psr\Http\Message\ServerRequestInterface; | ||||
| use Picea\Ui\Method\{ FormInterface, FormContextInterface }; | ||||
| use Storage\Session; | ||||
| use Lean\LanguageHandler; | ||||
| use Ulmus\Entity\EntityInterface; | ||||
| use Ulmus\User\Entity\UserInterface; | ||||
| use Ulmus\User\Lib\Authenticate; | ||||
| 
 | ||||
| interface FormFactoryInterface | ||||
| { | ||||
| /*    public function __construct(ServerRequestInterface $request, Authenticate $authenticate, Session $session, LanguageHandler $languageHandler, MessageFactoryInterface $messageFactory,); | ||||
| 
 | ||||
|     public function save(EntityInterface $entity): FormInterface; | ||||
| 
 | ||||
|     public function saveContext(?ServerRequestInterface $request = null, ?string $formName = null): FormContextInterface; | ||||
| 
 | ||||
|     public function delete(EntityInterface $entity): FormInterface; | ||||
| 
 | ||||
|     public function deleteContext(?ServerRequestInterface $request = null, ?string $formName = null): FormContextInterface;*/ | ||||
| } | ||||
| @ -8,6 +8,7 @@ use Notes\Attribute\Ignore; | ||||
| use Notes\Route\Attribute\Object\Route; | ||||
| use Notes\Security\Attribute\Security; | ||||
| use Picea, Picea\Ui\Method\FormContext; | ||||
| use Picea\Ui\Method\FormContextInterface; | ||||
| use TheBugs\Email\MailerInterface; | ||||
| use Storage\{ Cookie, Session }; | ||||
| use League\CommonMark\CommonMarkConverter; | ||||
| @ -212,7 +213,7 @@ trait ControllerTrait { | ||||
|     } | ||||
| 
 | ||||
|     #[Ignore]
 | ||||
|     public function pushContext(FormContext $context) : FormContext | ||||
|     public function pushContext(FormContextInterface $context) : FormContextInterface | ||||
|     { | ||||
|         $this->contextList[$context->formName ?? uniqid("context_")] = $context; | ||||
| 
 | ||||
| @ -220,7 +221,7 @@ trait ControllerTrait { | ||||
|     } | ||||
| 
 | ||||
|     #[Ignore]
 | ||||
|     public function context(? string $name = null) : ? FormContext | ||||
|     public function context(? string $name = null) : ? FormContextInterface | ||||
|     { | ||||
|         return $name ? $this->contextList[$name] : array_values($this->contextList)[0] ?? null; | ||||
|     } | ||||
|  | ||||
| @ -27,18 +27,15 @@ class Kernel { | ||||
| 
 | ||||
|     public array $paths = []; | ||||
| 
 | ||||
|     public int $errorReporting = E_ALL & ~E_USER_DEPRECATED & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE; | ||||
|     public int $errorReporting = E_ALL & ~E_USER_DEPRECATED & ~E_DEPRECATED & ~E_NOTICE; | ||||
| 
 | ||||
|     public array $definitionFilePaths; | ||||
| 
 | ||||
|     public string $errorLogPath; | ||||
| 
 | ||||
|     public string $projectPath; | ||||
| 
 | ||||
|     public function __construct(string $projectPath) | ||||
|     { | ||||
|         $this->projectPath = $projectPath; | ||||
| 
 | ||||
|     public function __construct( | ||||
|         public string $projectPath | ||||
|     ) { | ||||
|         $this->setEnvironment(); | ||||
|         $this->initializeEngine(); | ||||
|         $this->setupContainer(); | ||||
|  | ||||
							
								
								
									
										23
									
								
								view/lean/block/since.phtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								view/lean/block/since.phtml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | ||||
| {% arguments \DateInterval $interval %} | ||||
| 
 | ||||
| {% if $interval->y %} | ||||
|     {% lang "lean.date.interval.years", [ 'years' => $interval->y ] %}, | ||||
| {% endif %} | ||||
| 
 | ||||
| {% if $interval->m %} | ||||
|     {% lang "lean.date.interval.months", [ 'months' => $interval->m ] %}, | ||||
| {% endif %} | ||||
| 
 | ||||
| {% if $interval->d %} | ||||
|     {% lang "lean.date.interval.days", [ 'days' => $interval->d ] %}, | ||||
| {% endif %} | ||||
| 
 | ||||
| {% if $interval->h %} | ||||
|     {% lang "lean.date.interval.hours", [ 'hours' => $interval->h ] %}, | ||||
| {% endif %} | ||||
| 
 | ||||
| {% if $interval->i %} | ||||
|     {% lang "lean.date.interval.minutes", [ 'minutes' => $interval->i ] %} | ||||
| {% else %} | ||||
|     {% lang "lean.date.interval.seconds", [ 'seconds' => $interval->s ] %} | ||||
| {% endif %} | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user