Olivier Massot vor 3 Monaten
Ursprung
Commit
04f6b21347

+ 3 - 0
src/ApiResources/Freemium/FreemiumEvent.php

@@ -129,6 +129,9 @@ class FreemiumEvent implements ApiResourcesInterface
         $this->categories = new ArrayCollection();
     }
 
+    /**
+     * @return array<Categories>
+     */
     public function getCategories(): array
     {
         // retourne un tableau proprement indexé

+ 4 - 4
src/Entity/Booking/Event.php

@@ -92,14 +92,14 @@ class Event extends AbstractBooking
     #[ORM\Column(type: 'text', nullable: true)]
     protected ?string $description;
 
-    #[ORM\Column]
+    #[ORM\Column(nullable: true)]
     #[Assert\Url(
         message: 'url-error',
         protocols: ['http', 'https']
     )]
     protected ?string $url = null;
 
-    #[ORM\Column]
+    #[ORM\Column(nullable: true)]
     #[Assert\Url(
         message: 'url-ticket-error',
         protocols: ['http', 'https']
@@ -109,11 +109,11 @@ class Event extends AbstractBooking
     #[ORM\Column(length: 255, nullable: true, enumType: PricingEventEnum::class)]
     private ?PricingEventEnum $pricing = null;
 
-    #[ORM\Column]
+    #[ORM\Column(nullable: true)]
     #[Assert\Positive]
     protected ?float $priceMini = null;
 
-    #[ORM\Column]
+    #[ORM\Column(nullable: true)]
     #[Assert\Positive]
     protected ?float $priceMaxi = null;
 

+ 0 - 1
src/EventListener/OnKernelRequestPreRead.php

@@ -17,7 +17,6 @@ use Symfony\Component\HttpKernel\KernelEvents;
 class OnKernelRequestPreRead implements EventSubscriberInterface
 {
     public function __construct(
-        private RequestStack $requestStack,
         private Security $security,
         private FiltersConfigurationService $filtersConfigurationService,
     ) {

+ 7 - 7
src/Service/ApiResourceBuilder/Freemium/EventMappingBuilder.php

@@ -26,7 +26,7 @@ class EventMappingBuilder
      * @param Event $event : objet target
      * @param FreemiumEvent $freemiumEvent : objet source
      */
-    public function mapInformations(Event $event, FreemiumEvent $freemiumEvent)
+    public function mapInformations(Event $event, FreemiumEvent $freemiumEvent): void
     {
         $this->mapEventInformations( $event, $freemiumEvent);
         $this->mapEventPlaceInformations( $event, $freemiumEvent);
@@ -38,7 +38,7 @@ class EventMappingBuilder
      * @param Event $event : objet target
      * @param FreemiumEvent $freemiumEvent : objet source
      */
-    private function mapEventInformations(Event $event, FreemiumEvent $freemiumEvent)
+    private function mapEventInformations(Event $event, FreemiumEvent $freemiumEvent): void
     {
         //General informations
         $event->setName($freemiumEvent->name);
@@ -64,9 +64,9 @@ class EventMappingBuilder
      * Recherche et mapping du lieu de lévénement
      * @param Event $event
      * @param FreemiumEvent $freemiumEvent
-     * @return void
      */
-    private function mapEventPlaceInformations(Event $event, FreemiumEvent $freemiumEvent){
+    private function mapEventPlaceInformations(Event $event, FreemiumEvent $freemiumEvent): void
+    {
         $place = $this->getPlace($freemiumEvent);
         if($place !== null){
             $this->mapPlaceInformations($place, $freemiumEvent);
@@ -77,14 +77,14 @@ class EventMappingBuilder
 
     /**
      * Mapping des informations du lieux et de son adresse postale
+     * @param Place $place
      * @param FreemiumEvent $freemiumEvent
-     * @return Place|array|object[]
      */
     private function mapPlaceInformations(Place $place, FreemiumEvent $freemiumEvent): void
     {
         $addressPostal = $this->getAddressPostal($place);
 
-        //Mapping des informations de l'adresse
+        // Mapping des informations de l'adresse
         $addressPostal
             ->setStreetAddress($freemiumEvent->streetAddress)
             ->setStreetAddressSecond($freemiumEvent->streetAddressSecond)
@@ -97,8 +97,8 @@ class EventMappingBuilder
 
         //Mapping des informations du lieu
         $place
-            ->setName($freemiumEvent->placeName)
             ->setOrganization($freemiumEvent->organization)
+            ->setName($freemiumEvent->placeName)
             ->setAddressPostal($addressPostal);
     }
 

+ 2 - 4
src/Service/Organization/OrganizationFactory.php

@@ -720,13 +720,11 @@ class OrganizationFactory
         $contactPoint->setEmail($organizationMemberCreationRequest->getEmail());
 
         if ($organizationMemberCreationRequest->getPhone() !== null) {
-            $phoneNumber = $this->phoneNumberUtil->parse($organizationMemberCreationRequest->getPhone());
-            $contactPoint->setTelphone($phoneNumber);
+            $contactPoint->setTelphone($organizationMemberCreationRequest->getPhone());
         }
 
         if ($organizationMemberCreationRequest->getMobile() !== null) {
-            $mobileNumber = $this->phoneNumberUtil->parse($organizationMemberCreationRequest->getMobile());
-            $contactPoint->setMobilPhone($mobileNumber);
+            $contactPoint->setMobilPhone($organizationMemberCreationRequest->getMobile());
         }
 
         $contactPoint->setCreateDate($creationDate);

+ 3 - 4
src/Service/Shop/ShopService.php

@@ -107,10 +107,9 @@ class ShopService
         // Dispatch appropriate job based on request type
         switch ($shopRequest->getType()->value) {
             case ShopRequestType::NEW_STRUCTURE_ARTIST_PREMIUM_TRIAL->value:
-                $this->handleNewStructureArtistPremiumTrialRequest($shopRequest->getToken());
-//                $this->messageBus->dispatch(
-//                    new NewStructureArtistPremiumTrial($shopRequest->getToken())
-//                );
+                $this->messageBus->dispatch(
+                    new NewStructureArtistPremiumTrial($shopRequest->getToken())
+                );
                 break;
             default:
                 throw new \RuntimeException('request type not supported');

+ 2 - 2
src/Service/State/Provider/ProviderUtils.php

@@ -59,8 +59,8 @@ class ProviderUtils
     }
 
     /**
-     * @param $mappedItems
-     * @param $originalPaginator
+     * @param array<mixed> $mappedItems
+     * @param TraversablePaginator $originalPaginator
      * @return TraversablePaginator
      */
     public function getTraversablePaginator(array $mappedItems, TraversablePaginator $originalPaginator) : TraversablePaginator{

+ 0 - 2
src/Service/Twig/ToBase64Extension.php

@@ -5,14 +5,12 @@ namespace App\Service\Twig;
 
 use App\Service\Utils\PathUtils;
 use Path\Path;
-use Symfony\Component\Asset\Packages;
 use Twig\Extension\AbstractExtension;
 use Twig\TwigFilter;
 
 class ToBase64Extension extends AbstractExtension
 {
     public function __construct(
-        private Packages $packages,
         private string $projectDir
     ) {}
 

+ 2 - 3
src/State/Processor/Freemium/FreemiumEventProcessor.php

@@ -11,7 +11,6 @@ use App\ApiResources\Freemium\FreemiumEvent;
 use App\Entity\Booking\Event;
 use App\Repository\Booking\EventRepository;
 use App\Service\ApiResourceBuilder\Freemium\EventMappingBuilder;
-use App\Service\ApiResourceBuilder\Freemium\FreemiumEventBuilder;
 use App\State\Processor\EntityProcessor;
 use Doctrine\Common\Collections\ArrayCollection;
 use Doctrine\ORM\EntityManagerInterface;
@@ -31,8 +30,8 @@ class FreemiumEventProcessor extends EntityProcessor
     /**
      * @param FreemiumEvent $data
      * @param Operation $operation
-     * @param array $uriVariables
-     * @param array $context
+     * @param array<mixed> $uriVariables
+     * @param array<mixed> $context
      * @return FreemiumEvent
      */
     public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): FreemiumEvent

+ 2 - 2
src/State/Provider/Core/EventCategoryProvider.php

@@ -26,9 +26,9 @@ final class EventCategoryProvider implements ProviderInterface
      * @param mixed[] $uriVariables
      * @param mixed[] $context
      *
-     * @return EventCategory[]|EventCategory
+     * @return EventCategory[]
      */
-    public function provide(Operation $operation, array $uriVariables = [], array $context = []): array|EventCategory
+    public function provide(Operation $operation, array $uriVariables = [], array $context = []): array
     {
         if (!$operation instanceof GetCollection) {
             throw new \RuntimeException('Only GetCollection operation is supported', Response::HTTP_METHOD_NOT_ALLOWED);

+ 2 - 2
src/State/Provider/Freemium/FreemiumEventProvider.php

@@ -37,7 +37,7 @@ final class FreemiumEventProvider implements ProviderInterface
      * @throws \Doctrine\ORM\Exception\ORMException
      * @throws \Doctrine\ORM\OptimisticLockException
      */
-    public function provide(Operation $operation, array $uriVariables = [], array $context = []): TraversablePaginator|FreemiumEvent|null
+    public function provide(Operation $operation, array $uriVariables = [], array $context = []): TraversablePaginator|FreemiumEvent
     {
         if ($operation instanceof GetCollection) {
             return $this->provideCollection($operation, $context);
@@ -71,7 +71,7 @@ final class FreemiumEventProvider implements ProviderInterface
      * @throws \Doctrine\ORM\Exception\ORMException
      * @throws \Doctrine\ORM\OptimisticLockException
      */
-    private function provideItem(array $uriVariables, array $context): ?FreemiumEvent
+    private function provideItem(array $uriVariables, array $context): FreemiumEvent
     {
         $this->filtersConfigurationService->suspendTimeConstraintFilters();
         /** @var Event $event */

+ 2 - 2
src/State/Provider/Freemium/FreemiumPlaceProvider.php

@@ -33,7 +33,7 @@ final class FreemiumPlaceProvider implements ProviderInterface
      * @throws \Doctrine\ORM\Exception\ORMException
      * @throws \Doctrine\ORM\OptimisticLockException
      */
-    public function provide(Operation $operation, array $uriVariables = [], array $context = []): TraversablePaginator|FreemiumPlace|null
+    public function provide(Operation $operation, array $uriVariables = [], array $context = []): FreemiumPlace
     {
         if ($operation instanceof GetCollection) {
             throw new \RuntimeException('not supported', Response::HTTP_METHOD_NOT_ALLOWED);
@@ -48,7 +48,7 @@ final class FreemiumPlaceProvider implements ProviderInterface
      * @throws \Doctrine\ORM\Exception\ORMException
      * @throws \Doctrine\ORM\OptimisticLockException
      */
-    private function provideItem(array $uriVariables, array $context): ?FreemiumPlace
+    private function provideItem(array $uriVariables, array $context): FreemiumPlace
     {
         /** @var Place $place */
         $place = $this->placeRepository->find($uriVariables['id']);

+ 5 - 6
src/State/Provider/Search/PlaceSearchItemProvider.php

@@ -35,7 +35,7 @@ final class PlaceSearchItemProvider implements ProviderInterface
      * @throws \Doctrine\ORM\Exception\ORMException
      * @throws \Doctrine\ORM\OptimisticLockException
      */
-    public function provide(Operation $operation, array $uriVariables = [], array $context = []): TraversablePaginator|PlaceSearchItem|null
+    public function provide(Operation $operation, array $uriVariables = [], array $context = []): TraversablePaginator|PlaceSearchItem
     {
         if ($operation instanceof GetCollection) {
             return $this->provideCollection($operation, $context);
@@ -65,12 +65,11 @@ final class PlaceSearchItemProvider implements ProviderInterface
      * @throws \Doctrine\ORM\Exception\ORMException
      * @throws \Doctrine\ORM\OptimisticLockException
      */
-    private function provideItem(array $uriVariables, array $context): ?PlaceSearchItem
+    private function provideItem(array $uriVariables, array $context): PlaceSearchItem
     {
-        /** @var Event $event */
-        if(empty($event = $this->placeRepository->find($uriVariables['id']))){
-            throw new NotFoundHttpException('event not found');
+        if (empty($place = $this->placeRepository->find($uriVariables['id']))){
+            throw new NotFoundHttpException('Place not found');
         }
-        return $this->objectMapper->map($event, PlaceSearchItem::class);
+        return $this->objectMapper->map($place, PlaceSearchItem::class);
     }
 }