#87776Limit Restriction to table/s in QueryBuilder
Description
With the concept to apply restrictions to the query it is not possible to decide for which table it should be used.
In some cases it is needed to apply restriction only to a certain table.
Example:
$queryBuilder->getRestrictions()
->removeAll()
->add(GeneralUtility::makeInstance(DeletedRestriction::class))
->add(GeneralUtility::makeInstance(HiddenRestriction::class));
$queryBuilder->select('s.uid', 's.pid', 's.hidden', 's.title', 's.flag')
->from('sys_language', 's')
->from('pages_language_overlay', 'o')
->where(
$queryBuilder->expr()->eq('o.sys_language_uid', $queryBuilder->quoteIdentifier('s.uid')),
$queryBuilder->expr()->eq('o.pid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT))
);
In this example the HiddenRestriction should only be applied to “sys_language”, but will be applied to both tables currently.
So it should be possible to limit the restriction like:
$queryBuilder->getRestrictions()->add(GeneralUtility::makeInstance(HiddenRestriction::class, ['sys_language']))