src/Entity/Project.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProjectRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Form\FormTypeInterface;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. #[ORM\Entity(repositoryClassProjectRepository::class)]
  10. class Project
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     #[Groups(["getTimes""getClient""getProject""getReservation"])]
  16.     private ?int $id null;
  17.     #[ORM\Column(length45)]
  18.     #[Groups(["getTimes""getClient""getProject""getReservation"])]
  19.     private ?string $name null;
  20.     #[ORM\Column]
  21.     #[Groups(["getTimes""getClient""getProject"])]
  22.     private ?bool $active null;
  23.     #[ORM\OneToMany(mappedBy'project'targetEntityTime::class)]
  24.     private Collection $times;
  25.     #[ORM\ManyToMany(targetEntityUser::class, mappedBy'projects')]
  26.     private Collection $users;
  27.     #[ORM\ManyToOne(inversedBy'projects')]
  28.     #[ORM\JoinColumn(nullablefalse)]
  29.     #[Groups(["getProject""getReservation""getTimes"])]
  30.     private ?Client $client null;
  31.     #[ORM\ManyToOne]
  32.     #[Groups(["getProject"])]
  33.     private ?TagOrg $favoriteOrgTag null;
  34.     #[ORM\ManyToOne]
  35.     #[Groups(["getProject"])]
  36.     private ?TagType $favoriteTypeTag null;
  37.     #[ORM\Column(length255nullabletrue)]
  38.     #[Groups(["getProject"])]
  39.     private ?string $driveUrl null;
  40.     #[ORM\Column(length255nullabletrue)]
  41.     private ?string $token null;
  42.     // #[ORM\Column(length: 255, nullable: true)]
  43.     // private ?string $token = null;
  44.     public function __construct()
  45.     {
  46.         $this->times = new ArrayCollection();
  47.         $this->users = new ArrayCollection();
  48.     }
  49.     public function __toString(): string
  50.     {
  51.         return $this->name;
  52.     }
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getName(): ?string
  58.     {
  59.         return $this->name;
  60.     }
  61.     public function setName(string $name): self
  62.     {
  63.         $this->name $name;
  64.         return $this;
  65.     }
  66.     public function isActive(): ?bool
  67.     {
  68.         return $this->active;
  69.     }
  70.     public function getActive(): ?bool
  71.     {
  72.         return $this->active;
  73.     }
  74.     public function setActive(bool $active): self
  75.     {
  76.         $this->active $active;
  77.         return $this;
  78.     }
  79.     /**
  80.      * @return Collection<int, Time>
  81.      */
  82.     public function getTimes(): Collection
  83.     {
  84.         return $this->times;
  85.     }
  86.     public function addTime(Time $time): self
  87.     {
  88.         if (!$this->times->contains($time)) {
  89.             $this->times->add($time);
  90.             $time->setProject($this);
  91.         }
  92.         return $this;
  93.     }
  94.     public function removeTime(Time $time): self
  95.     {
  96.         if ($this->times->removeElement($time)) {
  97.             // set the owning side to null (unless already changed)
  98.             if ($time->getProject() === $this) {
  99.                 $time->setProject(null);
  100.             }
  101.         }
  102.         return $this;
  103.     }
  104.     /**
  105.      * @return Collection<int, User>
  106.      */
  107.     public function getUsers(): Collection
  108.     {
  109.         return $this->users;
  110.     }
  111.     public function addUser(User $user): self
  112.     {
  113.         if (!$this->users->contains($user)) {
  114.             $this->users->add($user);
  115.             $user->addProject($this);
  116.         }
  117.         return $this;
  118.     }
  119.     public function removeUser(User $user): self
  120.     {
  121.         if ($this->users->removeElement($user)) {
  122.             $user->removeProject($this);
  123.         }
  124.         return $this;
  125.     }
  126.     public function getClient(): ?Client
  127.     {
  128.         return $this->client;
  129.     }
  130.     public function setClient(?Client $client): self
  131.     {
  132.         $this->client $client;
  133.         return $this;
  134.     }
  135.     public function getFavoriteOrgTag(): ?TagOrg
  136.     {
  137.         return $this->favoriteOrgTag;
  138.     }
  139.     public function setFavoriteOrgTag(?TagOrg $favoriteOrgTag): self
  140.     {
  141.         $this->favoriteOrgTag $favoriteOrgTag;
  142.         return $this;
  143.     }
  144.     public function getFavoriteTypeTag(): ?TagType
  145.     {
  146.         return $this->favoriteTypeTag;
  147.     }
  148.     public function setFavoriteTypeTag(?TagType $favoriteTypeTag): self
  149.     {
  150.         $this->favoriteTypeTag $favoriteTypeTag;
  151.         return $this;
  152.     }
  153.     public function getDriveUrl(): ?string
  154.     {
  155.         return $this->driveUrl;
  156.     }
  157.     public function setDriveUrl(?string $driveUrl): static
  158.     {
  159.         $this->driveUrl $driveUrl;
  160.         return $this;
  161.     }
  162.     public function getToken(): ?string
  163.     {
  164.         return $this->token;
  165.     }
  166.     public function setToken(?string $token): static
  167.     {
  168.         $this->token $token;
  169.         return $this;
  170.     }
  171. }