/
forest-lynx
/
project
Обзор
Документация
Войти
/
forest-lynx
/
project
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/Entity/Project.php
164 строки
4 KB
forest-lynx
init
04 дек 2024, 10:44
04 дек 2024, 10:44
f4ceba2
Код
Авторство
О чём код?
<?php namespace App\Entity; use App\Enum\Status; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use App\Entity\ParticipationProject; use App\Repository\ProjectRepository; use DateTime; use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\ArrayCollection; use Symfony\Component\Validator\Constraints as Assert; #[ORM\Entity(repositoryClass: ProjectRepository::class)] class Project { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255)] #[Assert\NotBlank] #[Assert\Length(min: 2, max: 255)] private ?string $name = null; #[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)] private ?\DateTimeInterface $dateFrom = null; #[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)] private ?\DateTimeInterface $dateTo = null; #[ORM\Column(length: 120)] #[Assert\NotBlank] #[Assert\Length(min: 2, max: 120)] private ?string $client = null; #[ORM\Column(enumType: Status::class)] #[Assert\NotNull] private ?Status $status = null; /** * @var Collection<int, ParticipationProject> */ #[ORM\OneToMany(targetEntity: ParticipationProject::class, mappedBy: 'project', fetch: 'EAGER')] private Collection $developers; #[ORM\Column(type: Types::TEXT, nullable: true)] #[Assert\Length(max: 5000)] private ?string $description = null; public function __construct() { $this->developers = 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 getDateFrom(): ?\DateTimeInterface { return $this->dateFrom; } public function setDateFrom(\DateTimeInterface $dateFrom): static { $this->dateFrom = $dateFrom; return $this; } public function getDateTo(): ?\DateTimeInterface { return $this->dateTo; } public function setDateTo(?\DateTimeInterface $dateTo): static { $this->dateTo = $dateTo; return $this; } public function getClient(): ?string { return $this->client; } public function setClient(string $client): static { $this->client = $client; return $this; } public function getStatus(): ?Status { return $this->status; } public function setStatus(Status $status): static { $this->status = $status; return $this; } /** * @return Collection<int, ParticipationProject> */ public function getDevelopers(): Collection { return $this->developers; } public function addDeveloper(ParticipationProject $developer): static { if (!$this->developers->contains($developer)) { $this->developers->add($developer); $developer->setProject($this); } return $this; } public function removeDeveloper(ParticipationProject $developer): static { if ($this->developers->removeElement($developer)) { // set the owning side to null (unless already changed) if ($developer->getProject() === $this) { $developer->setProject(null); } } return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): static { $this->description = $description; return $this; } }