From 9259b99e7d7ad6db99051c52f19d0d6ae2cab378 Mon Sep 17 00:00:00 2001 From: Simon Kuehn Date: Mon, 18 May 2026 20:42:30 +0000 Subject: [PATCH] fix: allow null for ebayAspectFieldMappings on existing rows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Doctrine sets nullable JSON columns to null when the DB value is NULL. Typed array property cannot hold null — changing to ?array and coercing to [] in the getter. Co-Authored-By: Claude Sonnet 4.6 --- src/Domain/Article/ArticleType.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Domain/Article/ArticleType.php b/src/Domain/Article/ArticleType.php index 7907b04..bf3a1f7 100644 --- a/src/Domain/Article/ArticleType.php +++ b/src/Domain/Article/ArticleType.php @@ -25,10 +25,10 @@ class ArticleType /** * Maps eBay aspect name → Article field name (e.g. 'Marke' => 'manufacturer'). - * @var array + * @var array|null */ #[ORM\Column(type: 'json', nullable: true)] - private array $ebayAspectFieldMappings = []; + private ?array $ebayAspectFieldMappings = null; /** @var Collection */ #[ORM\OneToMany(targetEntity: ArticleTypeAttribute::class, mappedBy: 'articleType', cascade: ['persist', 'remove'], orphanRemoval: true)] @@ -80,7 +80,7 @@ class ArticleType /** @return array */ public function getEbayAspectFieldMappings(): array { - return $this->ebayAspectFieldMappings; + return $this->ebayAspectFieldMappings ?? []; } /** @param array $mappings */