Olivier Massot 3 anni fa
parent
commit
7b83edd03a

+ 3 - 2
src/Doctrine/Core/CurrentNotificationUserExtension.php

@@ -12,7 +12,8 @@ use Doctrine\ORM\QueryBuilder;
 use Symfony\Component\Security\Core\Security;
 
 /**
- * Class NotificationExtension : Filtre de sécurité par défaut pour une resource Notification
+ * Filtre de sécurité par défaut pour une resource NotificationUser
+ *
  * @package App\Doctrine\Core
  */
 final class CurrentNotificationUserExtension implements QueryCollectionExtensionInterface, QueryItemExtensionInterface
@@ -47,4 +48,4 @@ final class CurrentNotificationUserExtension implements QueryCollectionExtension
             ->setParameter('current_access', $currentUser)
         ;
     }
-}
+}

+ 4 - 3
src/Entity/Core/Notification.php

@@ -13,6 +13,7 @@ use Doctrine\Common\Collections\Collection;
 use Doctrine\ORM\Mapping as ORM;
 use JetBrains\PhpStorm\Pure;
 use Symfony\Component\Validator\Constraints as Assert;
+use App\Enum\Core\NotificationTypeEnum;
 
 /**
  * @todo : A la suite de la migration, il faut supprimer le nom de la table pour avoir une table Notification, et supprimer l'attribut discr.
@@ -56,17 +57,17 @@ class Notification
     #[ORM\Column(length: 40, nullable: true)]
     private ?string $name = null;
 
-    #[ORM\Column(type: 'date', nullable: true)]
+    #[ORM\Column(type: 'datetime', nullable: true)]
     private ?\DateTimeInterface $createDate;
 
-    #[ORM\Column(type: 'date', nullable: true)]
+    #[ORM\Column(type: 'datetime', nullable: true)]
     private ?\DateTimeInterface $updateDate;
 
     #[ORM\Column(type: 'json', length: 4294967295, nullable: true)]
     private mixed $message = [];
 
     #[ORM\Column(nullable: true)]
-    #[Assert\Choice(callback: ['\App\Enum\Core\NotificationTypeEnum', 'toArray'], message: 'invalid-type')]
+    #[Assert\Choice(callback: [NotificationTypeEnum::class, 'toArray'], message: 'invalid-type')]
     private ?string $type = null;
 
     #[ORM\Column(length: 255, nullable: true)]

+ 2 - 2
src/Entity/Core/NotificationUser.php

@@ -10,7 +10,7 @@ use Doctrine\ORM\Mapping as ORM;
 
 /**
  *
- * Classe NotificationUser. qui permet de gérer les notifications qui ont été lues par les Users.
+ * Les NotificationUser permettent de garder la trace des notifications qui ont été lues par les utilisateurs
  */
 #[ApiResource(
     collectionOperations: [
@@ -79,4 +79,4 @@ class NotificationUser
     {
         return $this->isRead;
     }
-}
+}

+ 1 - 0
src/Service/MercureHub.php

@@ -1,4 +1,5 @@
 <?php
+declare(strict_types=1);
 
 namespace App\Service;
 

+ 1 - 0
src/Service/Notifier.php

@@ -1,4 +1,5 @@
 <?php
+declare(strict_types=1);
 
 namespace App\Service;
 

+ 4 - 5
src/Service/ServiceIterator/CurrentAccessExtensionIterator.php

@@ -5,18 +5,17 @@ namespace App\Service\ServiceIterator;
 
 use App\Doctrine\Access\AccessExtensionInterface;
 use Doctrine\ORM\QueryBuilder;
-use Exception;
 
-class CurrentAccessExtensionIterator{
+class CurrentAccessExtensionIterator {
     public function __construct(private iterable $extensions)
     { }
 
-    public function addWhere(QueryBuilder $queryBuilder, $operationName){
+    public function addWhere(QueryBuilder $queryBuilder, $operationName) {
         /** @var AccessExtensionInterface $extension */
         foreach ($this->extensions as $extension){
-            if($extension->support($operationName))
+            if($extension->support($operationName)) {
                 return $extension->addWhere($queryBuilder);
+            }
         }
-        throw new Exception('no extension found for this operation');
     }
 }