196 lines
3.9 KiB
PHP
196 lines
3.9 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\IssueRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: IssueRepository::class)]
|
|
#[ORM\Index(name: 'idx_issue_row_sort', columns: ['rowstatus', 'rowsprint', 'rowversion', 'rowissue', 'id'])]
|
|
class Issue
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\Column(nullable: false)]
|
|
private array $redmine;
|
|
|
|
#[ORM\Column(nullable: false)]
|
|
private int $rowstatus = 0;
|
|
|
|
#[ORM\Column(nullable: false)]
|
|
private string $rowversion = '';
|
|
|
|
#[ORM\Column(nullable: false)]
|
|
private string $rowsprint = '';
|
|
|
|
#[ORM\Column(nullable: false)]
|
|
private int $rowissue = 0;
|
|
|
|
#[ORM\Column(nullable: true)]
|
|
private ?string $color = null;
|
|
|
|
#[ORM\Column(nullable: false)]
|
|
private bool $isClosed = false;
|
|
|
|
#[ORM\ManyToOne(targetEntity: Project::class, inversedBy: 'issues')]
|
|
#[ORM\JoinColumn(nullable: false)]
|
|
private Project $project;
|
|
|
|
#[ORM\ManyToOne(targetEntity: Issue::class, inversedBy: 'childs')]
|
|
#[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')]
|
|
private ?Issue $parent = null;
|
|
|
|
#[ORM\OneToMany(targetEntity: Issue::class, mappedBy: 'parent', cascade: ['persist'])]
|
|
#[ORM\OrderBy([
|
|
'rowstatus' => 'ASC',
|
|
'rowsprint' => 'DESC',
|
|
'rowversion' => 'DESC',
|
|
'rowissue' => 'ASC',
|
|
'id' => 'DESC',
|
|
])]
|
|
private Collection $childs;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->childs = new ArrayCollection();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function setId(int $id): static
|
|
{
|
|
$this->id = $id;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getRedmine(): array
|
|
{
|
|
return $this->redmine;
|
|
}
|
|
|
|
public function setRedmine(array $redmine): static
|
|
{
|
|
$this->redmine = $redmine;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getRowstatus(): int
|
|
{
|
|
return $this->rowstatus;
|
|
}
|
|
|
|
public function setRowstatus(int $rowstatus): static
|
|
{
|
|
$this->rowstatus = $rowstatus;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getRowversion(): string
|
|
{
|
|
return $this->rowversion;
|
|
}
|
|
|
|
public function setRowversion(string $rowversion): static
|
|
{
|
|
$this->rowversion = $rowversion;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getRowsprint(): string
|
|
{
|
|
return $this->rowsprint;
|
|
}
|
|
|
|
public function setRowsprint(string $rowsprint): static
|
|
{
|
|
$this->rowsprint = $rowsprint;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getRowissue(): int
|
|
{
|
|
return $this->rowissue;
|
|
}
|
|
|
|
public function setRowissue(int $rowissue): static
|
|
{
|
|
$this->rowissue = $rowissue;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getColor(): ?string
|
|
{
|
|
if ($this->color) {
|
|
return $this->color;
|
|
} elseif ($this->parent) {
|
|
return $this->parent->getColor();
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public function setColor(?string $color): static
|
|
{
|
|
$this->color = $color;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function isClosed(): bool
|
|
{
|
|
return $this->isClosed();
|
|
}
|
|
|
|
public function setIsClosed(bool $isClosed): static
|
|
{
|
|
$this->isClosed = $isClosed;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getProject(): Project
|
|
{
|
|
return $this->project;
|
|
}
|
|
|
|
public function setProject(Project $project): self
|
|
{
|
|
$this->project = $project;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getParent(): ?Issue
|
|
{
|
|
return $this->parent;
|
|
}
|
|
|
|
public function setParent(?Issue $issue): self
|
|
{
|
|
$this->parent = $issue;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Issue>
|
|
*/
|
|
public function getChilds(): Collection
|
|
{
|
|
return $this->childs;
|
|
}
|
|
}
|