Explorar o código

remove some deprecations and upgrade doctrine/dbal to 3.9

Olivier Massot hai 9 meses
pai
achega
7a33490525

+ 2 - 3
composer.json

@@ -17,9 +17,8 @@
     "ext-iconv": "*",
     "api-platform/core": "3.1.7",
     "beberlei/doctrineextensions": "^1.3",
-    "blackfire/php-sdk": "^1.23",
     "composer/package-versions-deprecated": "^1.11",
-    "doctrine/dbal": "^2.6",
+    "doctrine/dbal": "3.9",
     "doctrine/doctrine-bundle": "^2.1",
     "doctrine/doctrine-migrations-bundle": "^3.0",
     "doctrine/orm": "^2.17",
@@ -87,7 +86,7 @@
     "phpstan/phpstan-phpunit": "^1.3",
     "phpstan/phpstan-symfony": "^1.3",
     "phpunit/phpunit": "^9.6",
-    "rector/rector": "^0.15.13",
+    "rector/rector": "^1.2",
     "symfony/browser-kit": "6.3.*",
     "symfony/css-selector": "6.3.*",
     "symfony/debug-bundle": "6.3.*",

+ 2 - 0
config/packages/api_platform.yaml

@@ -21,3 +21,5 @@ api_platform:
             ## property is true which means that from now on null values are omitted during serialization.
             ## we don't want this => surcharge default value to false
             skip_null_values: false
+    graphql:
+        graphql_playground: false

+ 3 - 0
config/packages/liip_imagine.yaml

@@ -19,6 +19,9 @@ liip_imagine:
 
     data_loader: stream.storage
 
+    twig:
+        mode: 'lazy'
+
     filter_sets:
         sm:
             filters:

+ 0 - 3
src/Entity/Billing/Bill.php

@@ -19,9 +19,6 @@ use Doctrine\ORM\Mapping as ORM;
 #[ORM\Table(name: 'BillAccounting')]
 class Bill extends BillAccounting implements BillAccountingInterface
 {
-    #[ORM\Column(length: 255, nullable: false)]
-    protected string $discr = 'bill';
-
     #[ORM\ManyToOne(inversedBy: 'bills')]
     #[ORM\JoinColumn(nullable: false)]
     public ?Access $access;

+ 9 - 3
src/Entity/Billing/BillAccounting.php

@@ -19,6 +19,15 @@ use Doctrine\ORM\Mapping as ORM;
 #[ApiResource(operations: [])]
 // #[Auditable]
 #[ORM\Entity]
+#[ORM\InheritanceType('SINGLE_TABLE')]
+#[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
+#[ORM\DiscriminatorMap(
+    [
+        'billaccounting' => BillAccounting::class,
+        'bill' => Bill::class,
+        'billcredit' => BillCredit::class,
+    ]
+)]
 class BillAccounting
 {
     #[ORM\Id]
@@ -26,9 +35,6 @@ class BillAccounting
     #[ORM\GeneratedValue]
     protected ?int $id = null;
 
-    #[ORM\Column(length: 255, nullable: false)]
-    protected string $discr = 'billaccounting';
-
     #[ORM\ManyToOne]
     #[ORM\JoinColumn(nullable: true)]
     protected Organization $organization;

+ 0 - 3
src/Entity/Billing/BillCredit.php

@@ -20,9 +20,6 @@ use Doctrine\ORM\Mapping as ORM;
 #[ORM\Table(name: 'BillAccounting')]
 class BillCredit extends BillAccounting implements BillAccountingInterface
 {
-    #[ORM\Column(length: 255, nullable: false)]
-    protected string $discr = 'billcredit';
-
     #[ORM\ManyToOne(inversedBy: 'billCredits')]
     #[ORM\JoinColumn(nullable: false)]
     protected Access $access;

+ 1 - 1
src/EventListener/OnKernelRequestPreRead.php

@@ -22,7 +22,7 @@ class OnKernelRequestPreRead implements EventSubscriberInterface
     ) {
     }
 
-    public static function getSubscribedEvents()
+    public static function getSubscribedEvents(): array
     {
         return [
             KernelEvents::REQUEST => ['onKernelRequest', EventPriorities::PRE_READ],

+ 6 - 2
src/Serializer/DefaultNormalizer.php

@@ -60,10 +60,10 @@ final class DefaultNormalizer implements NormalizerInterface, DenormalizerInterf
      *
      * @throws \ReflectionException
      */
-    public function denormalize($data, $class, $format = null, array $context = []): mixed
+    public function denormalize($data, $type, $format = null, array $context = []): mixed
     {
         /** @phpstan-ignore-next-line */
-        $entity = $this->decorated->denormalize($data, $class, $format, $context);
+        $entity = $this->decorated->denormalize($data, $type, $format, $context);
 
         /** @var Access $access */
         $access = $this->security->getUser();
@@ -78,4 +78,8 @@ final class DefaultNormalizer implements NormalizerInterface, DenormalizerInterf
             $this->decorated->setSerializer($serializer);
         }
     }
+
+    public function getSupportedTypes(?string $format): array {
+        return ['*'];
+    }
 }