Actions
Bug #91201
closedDB check module: DeletedRestriction are always added to the QueryBuilder
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2020-04-27
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
QueryView, dbcheck, dbal,
Complexity:
Is Regression:
Sprint Focus:
Description
Problem/Description¶
Using the Full search feature of the QueryView allows the backend administrator to add the deleted
field to the Select fields form field. In the built query the DeletedRestriction::class
is always added as restriction, therefore it's actually useless to add a where clause on the deleted field in the form.
Affected TYPO3 versions at the time of issue-creation¶
- 10.4.1-dev
- 9.5
I doesn't tested older versions
Example of resulting DB query¶
SELECT
`uid`,
`type`,
`sys_language_uid`,
`pid`,
`deleted`,
`deleted`
FROM
`tx_theme_feature_teaser`
WHERE
(
tx_theme_feature_teaser.sys_language_uid = '1' AND tx_theme_feature_teaser.deleted = '1'
) AND(
`tx_theme_feature_teaser`.`deleted` = 0
)
LIMIT 100
What you can see?¶
deleted
field is added twice for the select (the first is from the manually added, the second from the code)- beside that the
deleted
field has a check for quoted1
(this works actually at least in MySQL (I had a issue for that #87710)), - the code adds always an additional check "unquoted" on deleted if it is
0
ToDo(s)¶
It seems to me that this is a mistake. As an administrator, you have to be able to search for deleted records. If this should never be the case, the column must not be selectable by the TYPO3 administrator.
I can imagine that these restrictions (->add(GeneralUtility::makeInstance(DeletedRestriction::class))
) should be added as needed depending on the built query by the administrator.
Actions