I have an Extbase model with an array typed property, the database saves the values as comma separated strings, and within the backend everythings works great. But within the frontend, the model always shows the property as empty. Is there anything I forgot to configure?
TCA column:
'offertypes' => [
'label' => 'offertypes',
'config' => [
'type' => 'select',
'renderType' => 'selectCheckBox',
'items' => [
['eins', 'eins'],
['zwei', 'zwei'],
]
]
]
Model:
protected array $offertypes = [];
public function getOffertypes(): array {
return $this->offertypes;
}
public function setOffertypes(array $offertypes): void {
$this->offertypes = $offertypes;
}
In older versions, I defined the property as string and the getters and setters handled the conversion with explode and implode, this worked in Typo3 v9.5, but not in 11.5:
protected string $offertypes = '';
public function getOffertypes(): array {
return explode(',', $this->offertypes);
}
public function setOffertypes(array $offertypes): void {
$this->offertypes = implode(',', $offertypes);
}