fix folder name

This commit is contained in:
2021-03-18 13:37:13 +01:00
parent a2f6773f5a
commit eaa0ad925f
1578 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,260 @@
<?php
namespace Chill\TaskBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\Person;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\HasScopeInterface;
use Chill\MainBundle\Entity\HasCenterInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Chill\MainBundle\Validator\Constraints\Entity\UserCircleConsistency;
/**
* AbstractTask
*
* @ORM\MappedSuperclass()
* @UserCircleConsistency(
* "CHILL_TASK_TASK_SHOW",
* getUserFunction="getAssignee"
* )
*/
abstract class AbstractTask implements HasScopeInterface, HasCenterInterface
{
/**
* @var string
*
* @ORM\Column(name="type", type="string", length=255)
*/
private $type;
/**
* @var json
*
* @ORM\Column(name="current_states", type="json")
*/
private $currentStates = [];
/**
* @var string
*
* @ORM\Column(name="title", type="text")
* @Assert\NotBlank()
*/
private $title = '';
/**
* @var string
*
* @ORM\Column(name="description", type="text")
*/
private $description = '';
/**
*
* @var User
* @ORM\ManyToOne(
* targetEntity="\Chill\MainBundle\Entity\User"
* )
*/
private $assignee;
/**
*
* @var Person
* @ORM\ManyToOne(
* targetEntity="\Chill\PersonBundle\Entity\Person"
* )
* @Assert\NotNull()
*/
private $person;
/**
*
* @var Scope
* @ORM\ManyToOne(
* targetEntity="\Chill\MainBundle\Entity\Scope"
* )
* @Assert\NotNull()
*/
private $circle;
/**
* @var boolean
* @ORM\Column(name="closed", type="boolean", options={ "default"=false })
*/
private $closed = false;
public function __construct()
{
}
/**
* Set type
*
* @param string $type
*
* @return AbstractTask
*/
public function setType($type)
{
$this->type = (string) $type;
return $this;
}
/**
* Get type
*
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* Set currentStates
*
* The current states are sorted in a single array, non associative.
*
* @param $currentStates
*
* @return AbstractTask
*/
public function setCurrentStates($currentStates)
{
$this->currentStates = \array_keys($currentStates);
return $this;
}
/**
* Get currentStates
*
* The states are returned as required by marking store format.
*
* @return array
*/
public function getCurrentStates()
{
return \array_fill_keys($this->currentStates, 1);
}
/**
* Set title
*
* @param string $title
*
* @return AbstractTask
*/
public function setTitle($title)
{
$this->title = (string) $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set description
*
* @param string $description
*
* @return AbstractTask
*/
public function setDescription($description)
{
$this->description = (string) $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
public function getAssignee(): ?User
{
return $this->assignee;
}
public function getPerson(): ?Person
{
return $this->person;
}
public function getCircle(): ?Scope
{
return $this->circle;
}
public function setAssignee(User $assignee = null)
{
$this->assignee = $assignee;
return $this;
}
public function setPerson(Person $person)
{
$this->person = $person;
return $this;
}
public function setCircle(Scope $circle)
{
$this->circle = $circle;
return $this;
}
public function getCenter(): ?\Chill\MainBundle\Entity\Center
{
if ($this->getPerson() instanceof Person) {
return $this->getPerson()->getCenter();
}
return null;
}
public function getScope(): ?\Chill\MainBundle\Entity\Scope
{
return $this->getCircle();
}
/**
* @return bool
*/
public function isClosed(): bool
{
return $this->closed;
}
/**
*
* @param bool $closed
*/
public function setClosed(bool $closed)
{
$this->closed = $closed;
}
}

View File

@@ -0,0 +1,210 @@
<?php
namespace Chill\TaskBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
/**
* RecurringTask
*
* @ORM\Table(name="chill_task.recurring_task")
* @ORM\Entity(repositoryClass="Chill\TaskBundle\Repository\RecurringTaskRepository")
*/
class RecurringTask extends AbstractTask
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var \DateTime
*
* @ORM\Column(name="first_occurence_end_date", type="date")
*/
private $firstOccurenceEndDate;
/**
* @var \DateTime
*
* @ORM\Column(name="last_occurence_end_date", type="date")
*/
private $lastOccurenceEndDate;
/**
* @var string
*
* @ORM\Column(name="occurence_frequency", type="string", length=255)
*/
private $occurenceFrequency;
/**
* @var dateinterval
*
* @ORM\Column(name="occurence_start_date", type="dateinterval")
*/
private $occurenceStartDate;
/**
* @var dateinterval
*
* @ORM\Column(name="occurence_warning_interval", type="dateinterval", nullable=true)
*/
private $occurenceWarningInterval;
/**
*
* @var Collection
*
* @ORM\OneToMany(
* targetEntity="SingleTask",
* mappedBy="recurringTask"
* )
*/
private $singleTasks;
public function __construct()
{
$this->singleTasks = new ArrayCollection();
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set firstOccurenceEndDate
*
* @param \DateTime $firstOccurenceEndDate
*
* @return RecurringTask
*/
public function setFirstOccurenceEndDate($firstOccurenceEndDate)
{
$this->firstOccurenceEndDate = $firstOccurenceEndDate;
return $this;
}
/**
* Get firstOccurenceEndDate
*
* @return \DateTime
*/
public function getFirstOccurenceEndDate()
{
return $this->firstOccurenceEndDate;
}
/**
* Set lastOccurenceEndDate
*
* @param \DateTime $lastOccurenceEndDate
*
* @return RecurringTask
*/
public function setLastOccurenceEndDate($lastOccurenceEndDate)
{
$this->lastOccurenceEndDate = $lastOccurenceEndDate;
return $this;
}
/**
* Get lastOccurenceEndDate
*
* @return \DateTime
*/
public function getLastOccurenceEndDate()
{
return $this->lastOccurenceEndDate;
}
/**
* Set occurenceFrequency
*
* @param string $occurenceFrequency
*
* @return RecurringTask
*/
public function setOccurenceFrequency($occurenceFrequency)
{
$this->occurenceFrequency = $occurenceFrequency;
return $this;
}
/**
* Get occurenceFrequency
*
* @return string
*/
public function getOccurenceFrequency()
{
return $this->occurenceFrequency;
}
/**
* Set occurenceStartDate
*
* @param dateinterval $occurenceStartDate
*
* @return RecurringTask
*/
public function setOccurenceStartDate($occurenceStartDate)
{
$this->occurenceStartDate = $occurenceStartDate;
return $this;
}
/**
* Get occurenceStartDate
*
* @return dateinterval
*/
public function getOccurenceStartDate()
{
return $this->occurenceStartDate;
}
/**
* Set occurenceWarningInterval
*
* @param dateinterval $occurenceWarningInterval
*
* @return RecurringTask
*/
public function setOccurenceWarningInterval($occurenceWarningInterval)
{
$this->occurenceWarningInterval = $occurenceWarningInterval;
return $this;
}
/**
* Get occurenceWarningInterval
*
* @return dateinterval
*/
public function getOccurenceWarningInterval()
{
return $this->occurenceWarningInterval;
}
}

View File

@@ -0,0 +1,234 @@
<?php
namespace Chill\TaskBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\Common\Collections\Collection;
/**
* SingleTask
*
* @ORM\Table(
* name="chill_task.single_task",
* indexes={
* @ORM\Index(
* name="by_type",
* columns={ "type" }
* ),
* @ORM\Index(
* name="by_current_state",
* columns={ "current_states" }
* )
* }
* )
* @ORM\Entity(repositoryClass="Chill\TaskBundle\Repository\SingleTaskRepository")
*/
class SingleTask extends AbstractTask
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var \DateTime
*
* @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"
* )
*/
private $startDate;
/**
* @var \DateTime
*
* @ORM\Column(name="end_date", type="date", nullable=true)
* @Assert\Date()
*/
private $endDate;
/**
* @var \DateInterval
* 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
* @ORM\ManyToOne(
* targetEntity="RecurringTask",
* inversedBy="singleTasks"
* )
*/
private $recurringTask;
/**
*
* @var \Doctrine\Common\Collections\Collection
* @ORM\OneToMany(
* targetEntity="\Chill\TaskBundle\Entity\Task\SingleTaskPlaceEvent",
* mappedBy="task",
* cascade={ "remove" }
* )
*/
private $taskPlaceEvents;
public function __construct()
{
$this->taskPlaceEvents = $events = new \Doctrine\Common\Collections\ArrayCollection;
parent::__construct();
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set startDate
*
* @param \DateTime $startDate
*
* @return SingleTask
*/
public function setStartDate($startDate)
{
$this->startDate = $startDate;
return $this;
}
/**
* Get startDate
*
* @return \DateTime
*/
public function getStartDate()
{
return $this->startDate;
}
/**
* Set endDate
*
* @param \DateTime $endDate
*
* @return SingleTask
*/
public function setEndDate($endDate)
{
$this->endDate = $endDate;
return $this;
}
/**
* Get endDate
*
* @return \DateTime
*/
public function getEndDate()
{
return $this->endDate;
}
/**
* Set warningInterval
*
* @param string $warningInterval
*
* @return SingleTask
*/
public function setWarningInterval($warningInterval)
{
$this->warningInterval = $warningInterval;
return $this;
}
/**
* Get warningInterval
*
* @return \DateInterval
*/
public function getWarningInterval()
{
return $this->warningInterval;
}
/**
* 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()
{
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;
}
function setRecurringTask(RecurringTask $recurringTask)
{
$this->recurringTask = $recurringTask;
}
public function getTaskPlaceEvents(): Collection
{
return $this->taskPlaceEvents;
}
public function setTaskPlaceEvents(Collection $taskPlaceEvents)
{
$this->taskPlaceEvents = $taskPlaceEvents;
return $this;
}
}

View File

@@ -0,0 +1,154 @@
<?php
namespace Chill\TaskBundle\Entity\Task;
use Doctrine\ORM\Mapping as ORM;
use Chill\MainBundle\Entity\User;
/**
* AbstractTaskPlaceEvent
*
* @ORM\MappedSuperclass()
*/
class AbstractTaskPlaceEvent
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var datetime_immutable
*
* @ORM\Column(name="datetime", type="datetime_immutable")
*/
private $datetime;
/**
* @var string
*
* @ORM\Column(name="transition", type="string", length=255)
*/
private $transition = '';
/**
* @var string
*
* @ORM\Column(name="data", type="json")
*/
private $data = [];
/**
*
* @var User
* @ORM\ManyToOne(
* targetEntity="\Chill\MainBundle\Entity\User"
* )
*/
private $author;
public function __construct()
{
$this->datetime = new \DateTimeImmutable('now');
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set datetime.
*
* @param datetime_immutable $datetime
*
* @return AbstractTaskPlaceEvent
*/
public function setDatetime($datetime)
{
$this->datetime = $datetime;
return $this;
}
/**
* Get datetime.
*
* @return datetime_immutable
*/
public function getDatetime()
{
return $this->datetime;
}
/**
* Set transition.
*
* @param string $transition
*
* @return AbstractTaskPlaceEvent
*/
public function setTransition($transition)
{
$this->transition = $transition;
return $this;
}
/**
* Get transition.
*
* @return string
*/
public function getTransition()
{
return $this->transition;
}
/**
* Set data.
*
* @param string $data
*
* @return AbstractTaskPlaceEvent
*/
public function setData($data)
{
$this->data = $data;
return $this;
}
/**
* Get data.
*
* @return string
*/
public function getData()
{
return $this->data;
}
public function getAuthor(): User
{
return $this->author;
}
public function setAuthor(User $author)
{
$this->author = $author;
return $this;
}
}

View File

@@ -0,0 +1,67 @@
<?php
/*
* Copyright (C) 2018 Champs Libres Cooperative <info@champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\TaskBundle\Entity\Task;
use Doctrine\ORM\Mapping as ORM;
use Chill\TaskBundle\Entity\SingleTask;
/**
*
*
* @ORM\Table(
* name="chill_task.single_task_place_event",
* indexes={
* @ORM\Index(
* name="transition_task_date",
* columns={"task_id", "transition", "datetime"}
* ),
* @ORM\Index(
* name="transition_task",
* columns={"task_id", "transition"}
* )
* })
* @ORM\Entity()
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
*/
class SingleTaskPlaceEvent extends AbstractTaskPlaceEvent
{
/**
*
* @var SingleTask
* @ORM\ManyToOne(
* targetEntity="\Chill\TaskBundle\Entity\SingleTask",
* inversedBy="taskPlaceEvents"
* )
*/
protected $task;
public function getTask(): SingleTask
{
return $this->task;
}
public function setTask(SingleTask $task)
{
$this->task = $task;
return $this;
}
}