adaptations for acl with tasks

This commit is contained in:
2021-10-26 18:05:06 +02:00
parent bae06fcc9c
commit 965ea528e3
22 changed files with 371 additions and 298 deletions

View File

@@ -40,12 +40,12 @@ class SingleTask extends AbstractTask
*
* @ORM\Column(name="start_date", type="date", nullable=true)
* @Assert\Date()
*
*
* @Assert\Expression(
* "value === null or this.getEndDate() === null or value < this.getEndDate()",
* message="The start date must be before the end date"
* )
*
*
* @Assert\Expression(
* "value === null or this.getWarningDate() === null or this.getWarningDate() > this.getStartDate()",
* message="The start date must be before warning date"
@@ -66,16 +66,16 @@ class SingleTask extends AbstractTask
* and this.getEndDate() === null
*
* @ORM\Column(name="warning_interval", type="dateinterval", nullable=true)
*
*
* @Assert\Expression(
* "!(value != null and this.getEndDate() == null)",
* message="An end date is required if a warning interval is set"
* )
*
*
*
*
*/
private $warningInterval;
/**
*
* @var RecurringTask
@@ -85,7 +85,7 @@ class SingleTask extends AbstractTask
* )
*/
private $recurringTask;
/**
*
* @var \Doctrine\Common\Collections\Collection
@@ -96,15 +96,15 @@ class SingleTask extends AbstractTask
* )
*/
private $taskPlaceEvents;
public function __construct()
{
$this->taskPlaceEvents = $events = new \Doctrine\Common\Collections\ArrayCollection;
parent::__construct();
}
/**
* Get id
*
@@ -186,13 +186,13 @@ class SingleTask extends AbstractTask
{
return $this->warningInterval;
}
/**
* Get the Warning date, computed from the difference between the
* Get the Warning date, computed from the difference between the
* end date and the warning interval
*
*
* Return null if warningDate or endDate is null
*
*
* @return \DateTimeImmutable
*/
public function getWarningDate()
@@ -200,15 +200,15 @@ class SingleTask extends AbstractTask
if ($this->getWarningInterval() === null) {
return null;
}
if ($this->getEndDate() === null) {
return null;
}
return \DateTimeImmutable::createFromMutable($this->getEndDate())
->sub($this->getWarningInterval());
}
function getRecurringTask(): RecurringTask
{
return $this->recurringTask;
@@ -227,7 +227,7 @@ class SingleTask extends AbstractTask
public function setTaskPlaceEvents(Collection $taskPlaceEvents)
{
$this->taskPlaceEvents = $taskPlaceEvents;
return $this;
}
}