Skip to content

Commit

Permalink
[BUGFIX] Fix wrong eval removal on TCA datetime migration
Browse files Browse the repository at this point in the history
Resolves: #4137
  • Loading branch information
helsner authored and simonschaufi committed Mar 7, 2024
1 parent 9046b7d commit d9d7933
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
9 changes: 7 additions & 2 deletions rules/TYPO312/v0/MigrateInputDateTimeRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,13 @@ protected function refactorColumn(Expr $columnName, Expr $columnTca): void
}
}

if (in_array('null', $evalList, true)) {
// Set "eval" to "null", since it's currently defined and the only allowed "eval" for type=datetime
// Set "eval" to "null" or "required", since they're currently defined and the only allowed "eval" for type=datetime
// Those will be migrated by according rector rules, but have to be kept by this one
if (in_array('null', $evalList, true) && in_array('required', $evalList, true)) {
$configArray->items[] = new ArrayItem(new String_('null,required'), new String_('eval'));
} elseif (in_array('required', $evalList, true)) {
$configArray->items[] = new ArrayItem(new String_('required'), new String_('eval'));
} elseif (in_array('null', $evalList, true)) {
$configArray->items[] = new ArrayItem(new String_('null'), new String_('eval'));
} else {
$this->removeArrayItemFromArrayByKey($configArray, 'eval');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,26 @@ return [
'eval' => 'trim,null,time,int',
],
],
'test_required' => [
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'readOnly' => true,
'size' => 20,
'max' => 1234,
'eval' => 'date,required',
],
],
'test_required_and_null' => [
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'readOnly' => true,
'size' => 20,
'max' => 1234,
'eval' => 'date,required,null',
],
],
'a_date_field' => [
'config' => [
'type' => 'input',
Expand Down Expand Up @@ -157,6 +177,24 @@ return [
'eval' => 'null',
],
],
'test_required' => [
'config' => [
'type' => 'datetime',
'readOnly' => true,
'size' => 20,
'format' => 'date',
'eval' => 'required',
],
],
'test_required_and_null' => [
'config' => [
'type' => 'datetime',
'readOnly' => true,
'size' => 20,
'format' => 'date',
'eval' => 'null,required',
],
],
'a_date_field' => [
'config' => [
'type' => 'datetime',
Expand Down

0 comments on commit d9d7933

Please sign in to comment.