fix: allow null for ebayAspectFieldMappings on existing rows

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 <noreply@anthropic.com>
This commit is contained in:
Simon Kuehn 2026-05-18 20:42:30 +00:00
parent ed2b83ba9f
commit 9259b99e7d

View file

@ -25,10 +25,10 @@ class ArticleType
/** /**
* Maps eBay aspect name Article field name (e.g. 'Marke' => 'manufacturer'). * Maps eBay aspect name Article field name (e.g. 'Marke' => 'manufacturer').
* @var array<string, string> * @var array<string, string>|null
*/ */
#[ORM\Column(type: 'json', nullable: true)] #[ORM\Column(type: 'json', nullable: true)]
private array $ebayAspectFieldMappings = []; private ?array $ebayAspectFieldMappings = null;
/** @var Collection<int, ArticleTypeAttribute> */ /** @var Collection<int, ArticleTypeAttribute> */
#[ORM\OneToMany(targetEntity: ArticleTypeAttribute::class, mappedBy: 'articleType', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OneToMany(targetEntity: ArticleTypeAttribute::class, mappedBy: 'articleType', cascade: ['persist', 'remove'], orphanRemoval: true)]
@ -80,7 +80,7 @@ class ArticleType
/** @return array<string, string> */ /** @return array<string, string> */
public function getEbayAspectFieldMappings(): array public function getEbayAspectFieldMappings(): array
{ {
return $this->ebayAspectFieldMappings; return $this->ebayAspectFieldMappings ?? [];
} }
/** @param array<string, string> $mappings */ /** @param array<string, string> $mappings */