feat: manual sorting of additional services
This commit is contained in:
1 parent
045fdea923
commit
455456b6bc
9 files changed
+253
-23
No files matched your search
@@ -52,7 +52,7 @@ class Accommodation implements BlameableEntityInterface, TimestampableEntityInte
|
||||
* @var Collection<int, AdditionalService>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: AdditionalService::class, mappedBy: 'accommodation', cascade: ['all'])]
|
||||
#[ORM\OrderBy(['dateFrom' => 'ASC', 'label' => 'ASC'])]
|
||||
#[ORM\OrderBy(['position' => 'ASC', 'dateFrom' => 'ASC', 'id' => 'ASC'])]
|
||||
private Collection $additionalServices;
|
||||
|
||||
#[ORM\Column]
|
||||
|
||||
@@ -59,6 +59,12 @@ class AdditionalService implements BlameableEntityInterface, TimestampableEntity
|
||||
#[ORM\Column]
|
||||
private bool $isExclusive = false;
|
||||
|
||||
/**
|
||||
* Manual presentation order within the accommodation, maintained by drag & drop in the admin.
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private int $position = 0;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->id = null;
|
||||
@@ -188,4 +194,16 @@ class AdditionalService implements BlameableEntityInterface, TimestampableEntity
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPosition(): int
|
||||
{
|
||||
return $this->position;
|
||||
}
|
||||
|
||||
public function setPosition(int $position): self
|
||||
{
|
||||
$this->position = $position;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user