|
|
@@ -26,6 +26,8 @@ class FiltersConfigurationService
|
|
|
*/
|
|
|
protected ?bool $previousTimeConstraintState = null;
|
|
|
|
|
|
+ protected bool $filtersConfigured = false;
|
|
|
+
|
|
|
public function __construct(
|
|
|
private EntityManagerInterface $entityManager,
|
|
|
private DateTimeConstraint $dateTimeConstraint,
|
|
|
@@ -55,6 +57,8 @@ class FiltersConfigurationService
|
|
|
$activityYearFilter = $this->getFilters()->enable('activity_year_filter');
|
|
|
$activityYearFilter->setAccessId($accessId);
|
|
|
$activityYearFilter->setTimeConstraint($this->activityYearConstraint);
|
|
|
+
|
|
|
+ $this->filtersConfigured = true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -65,8 +69,12 @@ class FiltersConfigurationService
|
|
|
*/
|
|
|
public function suspendTimeConstraintFilters(): void
|
|
|
{
|
|
|
+ if (!$this->filtersConfigured) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if ($this->previousTimeConstraintState !== null) {
|
|
|
- throw new \RuntimeException('time constraints is already suspended');
|
|
|
+ throw new \RuntimeException('The time constraints are already suspended');
|
|
|
}
|
|
|
|
|
|
if ($this->timeFiltersAlreadyDisabled()) {
|
|
|
@@ -112,8 +120,12 @@ class FiltersConfigurationService
|
|
|
*/
|
|
|
public function restoreTimeConstraintFilters(): void
|
|
|
{
|
|
|
+ if (!$this->filtersConfigured) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if ($this->previousTimeConstraintState === null) {
|
|
|
- throw new \RuntimeException('time constraints has not been suspended, can not be restored');
|
|
|
+ throw new \RuntimeException('The time constraints have not been suspended, can not be restored');
|
|
|
}
|
|
|
|
|
|
$this->enableFilter('date_time_filter');
|