src/Entity/Commercial.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CommercialRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassCommercialRepository::class)]
  8. class Commercial
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255nullabletrue)]
  15.     private ?string $fullname null;
  16.     #[ORM\Column]
  17.     private ?\DateTimeImmutable $createdAt null;
  18.     #[ORM\Column]
  19.     private ?\DateTimeImmutable $updatedAt null;
  20.     #[ORM\Column(length20nullabletrue)]
  21.     private ?string $tel null;
  22.     #[ORM\OneToMany(mappedBy'commercial'targetEntityJobCard::class)]
  23.     private Collection $jobcards;
  24.     public function __construct()
  25.     {
  26.         $this->jobcards = new ArrayCollection();
  27.     }
  28.     public function getId(): ?int
  29.     {
  30.         return $this->id;
  31.     }
  32.     public function getFullname(): ?string
  33.     {
  34.         return $this->fullname;
  35.     }
  36.     public function setFullname(?string $fullname): static
  37.     {
  38.         $this->fullname $fullname;
  39.         return $this;
  40.     }
  41.     public function getCreatedAt(): ?\DateTimeImmutable
  42.     {
  43.         return $this->createdAt;
  44.     }
  45.     public function setCreatedAt(\DateTimeImmutable $createdAt): static
  46.     {
  47.         $this->createdAt $createdAt;
  48.         return $this;
  49.     }
  50.     public function getUpdatedAt(): ?\DateTimeImmutable
  51.     {
  52.         return $this->updatedAt;
  53.     }
  54.     public function setUpdatedAt(\DateTimeImmutable $updatedAt): static
  55.     {
  56.         $this->updatedAt $updatedAt;
  57.         return $this;
  58.     }
  59.     public function getTel(): ?string
  60.     {
  61.         return $this->tel;
  62.     }
  63.     public function setTel(?string $tel): static
  64.     {
  65.         $this->tel $tel;
  66.         return $this;
  67.     }
  68.     /**
  69.      * @return Collection<int, JobCard>
  70.      */
  71.     public function getJobcards(): Collection
  72.     {
  73.         return $this->jobcards;
  74.     }
  75.     public function addJobcard(JobCard $jobcard): static
  76.     {
  77.         if (!$this->jobcards->contains($jobcard)) {
  78.             $this->jobcards->add($jobcard);
  79.             $jobcard->setCommercial($this);
  80.         }
  81.         return $this;
  82.     }
  83.     public function removeJobcard(JobCard $jobcard): static
  84.     {
  85.         if ($this->jobcards->removeElement($jobcard)) {
  86.             // set the owning side to null (unless already changed)
  87.             if ($jobcard->getCommercial() === $this) {
  88.                 $jobcard->setCommercial(null);
  89.             }
  90.         }
  91.         return $this;
  92.     }
  93. }