mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
fix query in timeline in activity and person bundle
This commit is contained in:
@@ -28,6 +28,7 @@ use Chill\MainBundle\Entity\Center;
|
||||
use Chill\PersonBundle\Security\Authorization\PersonVoter;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\MainBundle\Timeline\TimelineSingleQuery;
|
||||
|
||||
/**
|
||||
* Provide method to build timeline for accompanying periods
|
||||
@@ -88,14 +89,16 @@ abstract class AbstractTimelineAccompanyingPeriod implements TimelineProviderInt
|
||||
}
|
||||
|
||||
$metadata = $this->em
|
||||
->getClassMetadata(AccompanyingPeriodParticipation::class)
|
||||
->getClassMetadata(AccompanyingPeriod::class)
|
||||
;
|
||||
|
||||
return array(
|
||||
[$where, $parameters] = $this->buildWhereClause($context, $args);
|
||||
|
||||
return TimelineSingleQuery::fromArray([
|
||||
'id' => "{$metadata->getTableName()}.{$metadata->getColumnName('id')}",
|
||||
'FROM' => $this->buildFromClause($context),
|
||||
'WHERE' => $this->buildWhereClause($context, $args)
|
||||
);
|
||||
'WHERE' => $where,
|
||||
'parameters' => $parameters
|
||||
]);
|
||||
}
|
||||
|
||||
private function buildFromClause($context)
|
||||
@@ -130,9 +133,9 @@ abstract class AbstractTimelineAccompanyingPeriod implements TimelineProviderInt
|
||||
$join = $participation->getAssociationMapping('person')['joinColumns'][0];
|
||||
$person = $this->em->getClassMetadata(Person::class);
|
||||
$joinCenter = $person->getAssociationMapping('center')['joinColumns'][0];
|
||||
$allowedCenters = $this->authorizationHelper->filterReachableCenters($this->security->getUser(), $args['centers'], PersonVoter::SEE);
|
||||
|
||||
if ($context === 'center') {
|
||||
$allowedCenters = $this->authorizationHelper->filterReachableCenters($this->security->getUser(), $args['centers'], PersonVoter::SEE);
|
||||
$params = [];
|
||||
$questionMarks = [];
|
||||
$query = "{$person->getTableName()}.{$joinCenter['name']} IN (";
|
||||
|
Reference in New Issue
Block a user