You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

204 lines
4.2 KiB

<?php
namespace App\Entity;
use App\Repository\TaskRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
#[ORM\Entity(repositoryClass: TaskRepository::class)]
class Task
{
const STATUS_TODO = 'todo';
const STATUS_DOING = 'doing';
const STATUS_DONE = 'done';
const TRANSITION_START = 'start';
const TRANSITION_FINISH = 'finish';
const TRANSITION_CANCEL = 'cancel';
const TRANSITION_RESET = 'reset';
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(length: 255, unique: true)]
#[Gedmo\Slug(fields: ['name'])]
private ?string $slug = null;
#[ORM\Column(nullable: true)]
private ?int $urgent = null;
#[ORM\Column(nullable: true)]
private ?int $important = null;
#[ORM\Column(length: 255)]
private ?string $status = null;
#[ORM\ManyToOne(inversedBy: 'tasks')]
#[ORM\JoinColumn(nullable: false)]
private ?Project $project = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $geojson = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $osm = null;
/**
* @var Collection<int, Comment>
*/
#[ORM\OneToMany(targetEntity: Comment::class, mappedBy: 'task', orphanRemoval: true)]
private Collection $comments;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
public function __construct()
{
$this->comments = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function getUrgent(): ?int
{
return $this->urgent;
}
public function setUrgent(?int $urgent): static
{
$this->urgent = $urgent;
return $this;
}
public function getImportant(): ?int
{
return $this->important;
}
public function setImportant(?int $important): static
{
$this->important = $important;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus($status, array $context = []): static
{
$this->status = $status;
return $this;
}
public function getProject(): ?Project
{
return $this->project;
}
public function setProject(?Project $project): static
{
$this->project = $project;
return $this;
}
public function getGeojson(): ?string
{
return $this->geojson;
}
public function setGeojson(string $geojson): static
{
$this->geojson = $geojson;
return $this;
}
public function getOsm(): ?string
{
return $this->osm;
}
public function setOsm(string $osm): static
{
$this->osm = $osm;
return $this;
}
/**
* @return Collection<int, Comment>
*/
public function getComments(): Collection
{
return $this->comments;
}
public function addComment(Comment $comment): static
{
if (!$this->comments->contains($comment)) {
$this->comments->add($comment);
$comment->setTask($this);
}
return $this;
}
public function removeComment(Comment $comment): static
{
if ($this->comments->removeElement($comment)) {
// set the owning side to null (unless already changed)
if ($comment->getTask() === $this) {
$comment->setTask(null);
}
}
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
}