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:
parent
ed2b83ba9f
commit
9259b99e7d
1 changed files with 3 additions and 3 deletions
|
|
@ -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 */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue