Wenn ich in der DCA 'default' => null weglasse oder 'default' => 0 schreibe, dann bekomme ich beim Speichern diesen Fehler, wenn ich nichts auswähle:
Code:
An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: ‚‘ for column ‚stratigraphy‘ at row 1
Ausgelöst wird es durch dieses Query:
Code:
Doctrine\DBAL\Exception\DriverException {#8649
-query: Doctrine\DBAL\Query {#6588
-sql: "UPDATE tl_foss_taxonomy SET `stratigraphy` = ?, `tstamp` = ? WHERE id=?"
-params: array:3 [
0 => ""
1 => 1780387023
2 => "3"
]
-types: array:3 [?]
}
}
Definiert habe ich es in dem Fall so:
Entity
PHP-Code:
#[ORM\ManyToOne(targetEntity: FossStratigraphy::class)]
#[ORM\JoinColumn(name: 'stratigraphy', referencedColumnName: 'id', nullable: true, options: ['default' => null])]
private ?FossStratigraphy $stratigraphy = null;
DCA
PHP-Code:
'stratigraphy' => [
'inputType' => 'picker',
// 'default' => null,
'foreignKey' => 'tl_foss_stratigraphy.title',
'eval' => ['includeBlankOption' => true, 'tl_class' => 'w50'],
'relation' => ['type' => 'belongsTo', 'load' => 'lazy'],
],