src/Entity/FreelancerAssistant.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\FreelancerAssistantRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=FreelancerAssistantRepository::class)
  9.  * @ORM\EntityListeners({"App\Listener\FreelancerAssistantListener"})
  10.  */
  11. class FreelancerAssistant
  12. {
  13.     /**
  14.      * @ORM\Id()
  15.      * @ORM\GeneratedValue()
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\OneToOne(targetEntity=User::class, inversedBy="freelancerAssistant", cascade={"persist", "remove"})
  21.      * @ORM\JoinColumn(nullable=false)
  22.      */
  23.     private $user;
  24.     /**
  25.      * @ORM\ManyToOne(targetEntity=Freelancer::class, inversedBy="freelancerAssistants")
  26.      * @ORM\JoinColumn(nullable=false)
  27.      */
  28.     private $freelancer;
  29.     /**
  30.      * @ORM\ManyToMany(targetEntity=Store::class)
  31.      */
  32.     private $stores;
  33.     public function __construct()
  34.     {
  35.         $this->stores = new ArrayCollection();
  36.     }
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     public function getUser(): ?User
  42.     {
  43.         return $this->user;
  44.     }
  45.     public function setUser(User $user): self
  46.     {
  47.         $this->user $user;
  48.         return $this;
  49.     }
  50.     public function getFreelancer(): ?Freelancer
  51.     {
  52.         return $this->freelancer;
  53.     }
  54.     public function setFreelancer(?Freelancer $freelancer): self
  55.     {
  56.         $this->freelancer $freelancer;
  57.         return $this;
  58.     }
  59.     /**
  60.      * @return Collection|Store[]
  61.      */
  62.     public function getStores(): Collection
  63.     {
  64.         return $this->stores;
  65.     }
  66.     public function addStore(Store $store): self
  67.     {
  68.         if (!$this->stores->contains($store)) {
  69.             $this->stores[] = $store;
  70.         }
  71.         return $this;
  72.     }
  73.     public function removeStore(Store $store): self
  74.     {
  75.         if ($this->stores->contains($store)) {
  76.             $this->stores->removeElement($store);
  77.         }
  78.         return $this;
  79.     }
  80. }