Feat: Add teamer filter

This commit is contained in:
Björn Fromme committed 2023-10-25 09:37:40 +02:00
1 parent 51b2c9bb11
commit eb53e2a843
11 files changed
+475 -43

No files matched your search

+6 -32
View File
@@ -5,39 +5,18 @@ namespace App\Model;
use App\Entity\Destination;
use App\Entity\JobProfile;
class AssignmentFilterDto
class AssignmentFilterDto extends AbstractFilterDto
{
public const DURATION_WEEKEND = 1;
public const DURATION_MID_WEEK = 2;
public const DURATION_FULL_WEEK = 3;
public const DURATION_MORE = 4;
private ?\DateTimeImmutable $dateFrom = null;
private ?\DateTimeImmutable $dateTo = null;
private ?JobProfile $jobProfile = null;
private ?Destination $destination = null;
private ?int $duration = null;
public function isActive(): bool
{
return $this->getActiveFiltersCount() > 0;
}
public function getActiveFiltersCount(): int
{
$freshInstance = new static();
$filterCount = 0;
$reflection = new \ReflectionClass(static::class);
foreach ($reflection->getProperties() as $property) {
$name = $property->getName();
if ($this->$name !== $freshInstance->$name) {
++$filterCount;
}
}
return $filterCount;
}
protected ?\DateTimeImmutable $dateFrom = null;
protected ?\DateTimeImmutable $dateTo = null;
protected ?JobProfile $jobProfile = null;
protected ?Destination $destination = null;
protected ?int $duration = null;
public function getDateFrom(): ?\DateTimeImmutable
{
@@ -98,9 +77,4 @@ class AssignmentFilterDto
return $this;
}
public function isReset(): bool
{
return $this->reset;
}
}