mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Remove dead code
This commit is contained in:
parent
06c74ed5ed
commit
358410cde1
@ -96,29 +96,6 @@ final class ActivityACLAwareRepository
|
|||||||
$where = '';
|
$where = '';
|
||||||
$parameters = [];
|
$parameters = [];
|
||||||
|
|
||||||
// condition will be:
|
|
||||||
// FROM activity JOIN person -- not set by us
|
|
||||||
// ON activity.person_id = person.id -- not set by us
|
|
||||||
// WHERE -- not set by us
|
|
||||||
// activity.person_id = ? AND -- only if $context = person
|
|
||||||
// ( -- begin loop through centers, center#0
|
|
||||||
// person.center_id = ?
|
|
||||||
// AND ( -- begin loop for scopes within centers
|
|
||||||
// activity.scope_id = ? -- scope#0
|
|
||||||
// OR -- if scope#i where i > 0
|
|
||||||
// activity.scope_id = ? -- scope#1
|
|
||||||
// )
|
|
||||||
// )
|
|
||||||
// OR -- if center#i where i > 0
|
|
||||||
// ( -- begin loop through centers, center#1
|
|
||||||
// person.center_id = ?
|
|
||||||
// AND ( -- begin loop for scopes within centers
|
|
||||||
// activity.scope_id = ? -- scope#0
|
|
||||||
// OR -- if scope#i where i > 0
|
|
||||||
// activity.scope_id = ? -- scope#1
|
|
||||||
// )
|
|
||||||
// )
|
|
||||||
|
|
||||||
$metadataActivity = $this->em->getClassMetadata(Activity::class);
|
$metadataActivity = $this->em->getClassMetadata(Activity::class);
|
||||||
$metadataPerson = $this->em->getClassMetadata(Person::class);
|
$metadataPerson = $this->em->getClassMetadata(Person::class);
|
||||||
$activityToPerson = $metadataActivity->getAssociationMapping('person')['joinColumns'][0]['name'];
|
$activityToPerson = $metadataActivity->getAssociationMapping('person')['joinColumns'][0]['name'];
|
||||||
@ -190,58 +167,3 @@ final class ActivityACLAwareRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
$qb = $this->repository->createQueryBuilder('a');
|
|
||||||
$qb->select(['a.id', "'activity'", 'a.date']);
|
|
||||||
$qb->join('a.person', 'p');
|
|
||||||
|
|
||||||
switch($context) {
|
|
||||||
case 'center':
|
|
||||||
$qb->where($this->queryTimelineIndexerWhereForCenter($qb, $args['centers']));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new \LogicException('context not supported');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($from) {
|
|
||||||
$qb->andWhere($qb->gt('a.date', ':from'));
|
|
||||||
$qb->setParameter('from', $from);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($to) {
|
|
||||||
$qb->andWhere($qb->gt('a.date', ':to'));
|
|
||||||
$qb->setParameter('to', $to);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $qb->getQuery();
|
|
||||||
}
|
|
||||||
|
|
||||||
private function queryTimelineIndexerWhereForCenter(QueryBuilder $qb, array $centers): Orx
|
|
||||||
{
|
|
||||||
$i = 0;
|
|
||||||
$orx = $qb->expr()->orX();
|
|
||||||
|
|
||||||
foreach ($centers as $center) {
|
|
||||||
$andx = $qb->expr()->andX();
|
|
||||||
$andx->add($qb->expr()->eq('p.center', ":center_$i"));
|
|
||||||
$qb->setParameter("center_$i", $center);
|
|
||||||
$i++;
|
|
||||||
|
|
||||||
$scopes = $this->authorizationHelper->getReachableCircles(
|
|
||||||
$this->tokenStorage->getToken()->getUser(),
|
|
||||||
new Role(ActivityVoter::SEE_DETAILS),
|
|
||||||
$center,
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($scopes as $scope) {
|
|
||||||
$andx->add($qb->expr()->eq('a.scope', ":scope_$i"));
|
|
||||||
$qb->setParameter("scope_$i", $scope);
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$orx->add($andx);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $orx;
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user