hasParameter('_time_constraint') || !boolval(StringsUtils::unquote($this->getParameter('_time_constraint'))) || !$this->hasParameter('accessId') ) return ''; $dateTimeConstraintAware = $targetEntity->getReflectionClass()->getAttributes(DateTimeConstraintAware::class)[0] ?? null; $startFieldName = $dateTimeConstraintAware?->getArguments()['startDateFieldName'] ?? null; $endFieldName = $dateTimeConstraintAware?->getArguments()['endDateFieldName'] ?? null; if ($startFieldName === '' || is_null($startFieldName) || $endFieldName === '' || is_null($endFieldName)) { return ''; } $accessId = intval(StringsUtils::unquote($this->getParameter('accessId'))); $constraints = $this->dateTimeConstraint->invoke($accessId); $fields = [ DateTimeConstraint::START_KEY => $startFieldName, DateTimeConstraint::END_KEY => $endFieldName ]; return $this->constructQuery($constraints, $targetTableAlias, $fields); } /** * Permets d'assurer l'injection de dépendance du service DateTimeConstraint * @param DateTimeConstraint $dateTimeConstraint */ public function setDateTimeConstraint(DateTimeConstraint $dateTimeConstraint){ $this->dateTimeConstraint = $dateTimeConstraint; } }