| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Booking;
- use App\Entity\Core\File;
- use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * Classe ... qui ...
- */
- #[Auditable]
- #[ORM\Entity]
- class Work
- {
- #[ORM\Id]
- #[ORM\Column]
- #[ORM\GeneratedValue]
- private ?int $id = null;
- #[ORM\ManyToOne(inversedBy: 'work')]
- private Course $course;
- #[ORM\OneToMany(mappedBy: 'work',targetEntity: WorkByUser::class, cascade: ['persist'], orphanRemoval: true)]
- private $workByUsers;
- #[ORM\OneToMany(mappedBy: 'work',targetEntity: File::class, orphanRemoval: true)]
- private $files;
- public function __construct()
- {
- $this->workByUsers = new ArrayCollection();
- $this->files = new ArrayCollection();
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getCourse(): ?Course
- {
- return $this->course;
- }
- public function setCourse(?Course $course): self
- {
- $this->course = $course;
- return $this;
- }
- /**
- * @return Collection<int, WorkByUser>
- */
- public function getWorkByUsers(): Collection
- {
- return $this->workByUsers;
- }
- public function addWorkByUser(WorkByUser $workByUser): self
- {
- if (!$this->workByUsers->contains($workByUser)) {
- $this->workByUsers[] = $workByUser;
- $workByUser->setWork($this);
- }
- return $this;
- }
- public function removeWorkByUser(WorkByUser $workByUser): self
- {
- if ($this->workByUsers->removeElement($workByUser)) {
- // set the owning side to null (unless already changed)
- if ($workByUser->getWork() === $this) {
- $workByUser->setWork(null);
- }
- }
- return $this;
- }
- /**
- * @return Collection<int, File>
- */
- public function getFiles(): Collection
- {
- return $this->files;
- }
- public function addFile(File $file): self
- {
- if (!$this->files->contains($file)) {
- $this->files[] = $file;
- $file->setWork($this);
- }
- return $this;
- }
- public function removeFile(File $file): self
- {
- if ($this->files->removeElement($file)) {
- // set the owning side to null (unless already changed)
- if ($file->getWork() === $this) {
- $file->setWork(null);
- }
- }
- return $this;
- }
- }
|