220 lines
4.7 KiB
PHP
220 lines
4.7 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\ProjectRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: ProjectRepository::class)]
|
|
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_project_title', fields: ['title'])]
|
|
class Project
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\Column(length: 255, unique: true)]
|
|
private ?string $title = null;
|
|
|
|
#[ORM\Column(length: 255, nullable: true)]
|
|
private ?string $logo = null;
|
|
|
|
#[ORM\Column(type: 'datetime', nullable: true)]
|
|
private ?\DateTimeInterface $updateAt = null;
|
|
|
|
#[ORM\Column(type: 'datetime', nullable: true)]
|
|
private ?\DateTimeInterface $updateIssuesAt = null;
|
|
|
|
#[ORM\Column(nullable: false)]
|
|
private array $redmine;
|
|
|
|
#[ORM\Column(nullable: true)]
|
|
private ?array $hiddenstatuses = null;
|
|
|
|
#[ORM\Column(nullable: true)]
|
|
private ?array $hiddensprints = null;
|
|
|
|
#[ORM\Column(nullable: true)]
|
|
private ?array $hiddenversions = null;
|
|
|
|
/**
|
|
* @var Collection<int, User>
|
|
*/
|
|
#[ORM\ManyToMany(targetEntity: User::class, mappedBy: 'projects')]
|
|
private Collection $users;
|
|
|
|
/**
|
|
* @var Collection<int, Issue>
|
|
*/
|
|
#[ORM\OneToMany(targetEntity: Issue::class, mappedBy: 'project', cascade: ['persist', 'remove'], orphanRemoval: true)]
|
|
#[ORM\OrderBy([
|
|
'rowstatus' => 'ASC',
|
|
'rowsprint' => 'DESC',
|
|
'rowversion' => 'DESC',
|
|
'rowissue' => 'ASC',
|
|
'id' => 'DESC',
|
|
])]
|
|
private Collection $issues;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->users = new ArrayCollection();
|
|
$this->issues = new ArrayCollection();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function setId(int $id): static
|
|
{
|
|
$this->id = $id;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getTitle(): ?string
|
|
{
|
|
return $this->title;
|
|
}
|
|
|
|
public function setTitle(string $title): static
|
|
{
|
|
$this->title = $title;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getLogo(): ?string
|
|
{
|
|
return $this->logo ? $this->logo : 'medias/logo/logo.png';
|
|
}
|
|
|
|
public function setLogo(?string $logo): static
|
|
{
|
|
$this->logo = $logo;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getUpdateAt(): ?\DateTimeInterface
|
|
{
|
|
return $this->updateAt;
|
|
}
|
|
|
|
public function setUpdateAt(?\DateTimeInterface $updateAt): static
|
|
{
|
|
$this->updateAt = $updateAt;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getUpdateIssuesAt(): ?\DateTimeInterface
|
|
{
|
|
return $this->updateIssuesAt;
|
|
}
|
|
|
|
public function setUpdateIssuesAt(?\DateTimeInterface $updateIssuesAt): static
|
|
{
|
|
$this->updateIssuesAt = $updateIssuesAt;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getRedmine(): array
|
|
{
|
|
return $this->redmine;
|
|
}
|
|
|
|
public function setRedmine(array $redmine): static
|
|
{
|
|
$this->redmine = $redmine;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getHiddenstatuses(): ?array
|
|
{
|
|
return $this->hiddenstatuses;
|
|
}
|
|
|
|
public function setHiddenstatuses(array $hiddenstatuses): static
|
|
{
|
|
$this->hiddenstatuses = $hiddenstatuses;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getHiddensprints(): ?array
|
|
{
|
|
return $this->hiddensprints;
|
|
}
|
|
|
|
public function setHiddensprints(array $hiddensprints): static
|
|
{
|
|
$this->hiddensprints = $hiddensprints;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getHiddenversions(): ?array
|
|
{
|
|
return $this->hiddenversions;
|
|
}
|
|
|
|
public function setHiddenversions(array $hiddenversions): static
|
|
{
|
|
$this->hiddenversions = $hiddenversions;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, User>
|
|
*/
|
|
public function getUsers(): Collection
|
|
{
|
|
return $this->users;
|
|
}
|
|
|
|
public function addUser(User $user): static
|
|
{
|
|
if (!$this->users->contains($user)) {
|
|
$this->users->add($user);
|
|
$user->addProject($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeUser(User $user): static
|
|
{
|
|
if ($this->users->removeElement($user)) {
|
|
$user->removeProject($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Issue>
|
|
*/
|
|
public function getIssues(): Collection
|
|
{
|
|
return $this->issues;
|
|
}
|
|
|
|
public function addIssue(Issue $issue): self
|
|
{
|
|
if (!$this->issues->contains($issue)) {
|
|
$this->issues[] = $issue;
|
|
$issue->setProject($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
}
|