Skip to content

Commit

Permalink
[BUGFIX] Resolve wrongful eval removal on TCA datetime migration
Browse files Browse the repository at this point in the history
Resolves: #4137
  • Loading branch information
helsner committed Mar 5, 2024
1 parent bb3f8a1 commit 18e3c7b
Show file tree
Hide file tree
Showing 2 changed files with 26 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,16 @@ return [
'eval' => 'trim,null,time,int',
],
],
'test_required' => [
'config' => [
'type' => 'input',
'renderType' => 'inputDateTime',
'readOnly' => true,
'size' => 20,
'max' => 1234,
'eval' => 'date,required',
],
],
'a_date_field' => [
'config' => [
'type' => 'input',
Expand Down Expand Up @@ -157,6 +167,15 @@ return [
'eval' => 'null',
],
],
'test_required' => [
'config' => [
'type' => 'datetime',
'readOnly' => true,
'size' => 20,
'format' => 'date',
'eval' => 'required',
],
],
'a_date_field' => [
'config' => [
'type' => 'datetime',
Expand Down

0 comments on commit 18e3c7b

Please sign in to comment.