mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-12 11:56:14 +00:00
Refactor scope condition logic in FilterListAccompanyingPeriodHelper
Replaced inline string interpolation with `sprintf` for scope conditions and added user-based condition handling. Introduced new user-specific parameters to enhance query flexibility. Removed unused `AuthorizationHelperForCurrentUserInterface` import.
This commit is contained in:
parent
9a50dad671
commit
00350b9efc
@ -13,7 +13,6 @@ namespace Chill\PersonBundle\Export\Helper;
|
||||
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Repository\CenterRepositoryInterface;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperForCurrentUserInterface;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
|
||||
@ -61,15 +60,16 @@ final readonly class FilterListAccompanyingPeriodHelper implements FilterListAcc
|
||||
|
||||
foreach ($scopes as $scope) {
|
||||
$scopeCondition = match (in_array($scope, $scopesConfidential, true)) {
|
||||
true => ":scope_{$i} MEMBER OF acp.scopes",
|
||||
true => sprintf(':scope_%s MEMBER OF acp.scopes', $i),
|
||||
false => $qb->expr()->andX(
|
||||
'acp.confidential = FALSE',
|
||||
":scope_{$i} MEMBER OF acp.scopes",
|
||||
sprintf(':scope_%s MEMBER OF acp.scopes', $i),
|
||||
),
|
||||
};
|
||||
|
||||
$orScopes->add($scopeCondition);
|
||||
$orScopes->add($qb->expr()->orX(sprintf('acp.user = :user_%d', $i), $scopeCondition));
|
||||
$qb->setParameter("scope_{$i}", $scope);
|
||||
$qb->setParameter("user_{$i}", $user);
|
||||
++$i;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user