Vincent 1 год назад
Родитель
Сommit
cef5db4906

+ 2 - 2
src/Entity/Access/Access.php

@@ -2142,9 +2142,9 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
         return $this;
     }
 
-    public function setPreferences(Preferences $preferences = null)
+    public function setPreferences(?Preferences $preferences = null)
     {
-        if(!is_null($preferences)){
+        if (!is_null($preferences)) {
             $preferences->setAccess($this);
         }
         $this->preferences = $preferences;

+ 2 - 2
src/Entity/Access/Preferences.php

@@ -11,7 +11,7 @@ use ApiPlatform\Metadata\Put;
 use Doctrine\ORM\Mapping as ORM;
 
 /**
- * Préférence pour un Access
+ * Préférence pour un Access.
  */
 // #[Auditable]
 #[ORM\Entity]
@@ -22,7 +22,7 @@ use Doctrine\ORM\Mapping as ORM;
         ),
         new Put(
             security: 'object.getAccess().getId() == user.getId()'
-        )
+        ),
     ]
 )]
 class Preferences

+ 2 - 0
src/Entity/Public/PublicEvent.php

@@ -352,6 +352,7 @@ class PublicEvent
     public function setStructureLongitude(?float $structureLongitude): self
     {
         $this->structureLongitude = $structureLongitude;
+
         return $this;
     }
 
@@ -363,6 +364,7 @@ class PublicEvent
     public function setStructureLatitude(?float $structureLatitude): self
     {
         $this->structureLatitude = $structureLatitude;
+
         return $this;
     }
 

+ 7 - 5
src/Service/Access/AccessProfileCreator.php

@@ -21,7 +21,7 @@ class AccessProfileCreator
         private readonly OrganizationProfileCreator $organizationProfileCreator,
         private readonly AccessRepository $accessRepository,
         private readonly Utils $accessUtils,
-        private readonly EntityManagerInterface $entityManager
+        private readonly EntityManagerInterface $entityManager,
     ) {
     }
 
@@ -39,7 +39,7 @@ class AccessProfileCreator
             throw new AuthenticationException('no_valid_access', 401);
         }
 
-        if(is_null($access->getPreferences())){
+        if (is_null($access->getPreferences())) {
             $this->createPreferences($access);
         }
 
@@ -113,12 +113,14 @@ class AccessProfileCreator
     }
 
     /**
-     * Créer l'entrée des Preferences en base
+     * Créer l'entrée des Preferences en base.
+     *
      * @see AccessProfileCreatorTest::testCreatePreferences()
-     * @param Access $access
+     *
      * @return void
      */
-    public function createPreferences(Access $access){
+    public function createPreferences(Access $access)
+    {
         $access->setPreferences(new Preferences());
         $this->entityManager->flush($access);
     }