This commit is contained in:
2025-07-09 22:12:43 +02:00
parent 0a178899d7
commit 1cc4db4943
5 changed files with 207 additions and 28 deletions

View File

@ -3,6 +3,8 @@
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)]
@ -32,6 +34,25 @@ class Issue
#[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;
@ -115,4 +136,24 @@ class Issue
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;
}
}