src/Entity/Client.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ClientRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ClientRepository::class)
  9.  */
  10. class Client
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\OneToMany(targetEntity=Project::class, mappedBy="client")
  24.      */
  25.     private $projects;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $slug;
  30.     public function __construct()
  31.     {
  32.         $this->projects = new ArrayCollection();
  33.     }
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     /**
  39.      * @param mixed $id
  40.      */
  41.     public function setId($id): void
  42.     {
  43.         $this->id $id;
  44.     }
  45.     public function getName(): ?string
  46.     {
  47.         return $this->name;
  48.     }
  49.     public function setName(string $name): self
  50.     {
  51.         $this->name $name;
  52.         return $this;
  53.     }
  54.     /**
  55.      * @return Collection|Project[]
  56.      */
  57.     public function getProjects(): Collection
  58.     {
  59.         return $this->projects;
  60.     }
  61.     public function addProject(Project $project): self
  62.     {
  63.         if (!$this->projects->contains($project)) {
  64.             $this->projects[] = $project;
  65.             $project->setClient($this);
  66.         }
  67.         return $this;
  68.     }
  69.     public function removeProject(Project $project): self
  70.     {
  71.         if ($this->projects->removeElement($project)) {
  72.             // set the owning side to null (unless already changed)
  73.             if ($project->getClient() === $this) {
  74.                 $project->setClient(null);
  75.             }
  76.         }
  77.         return $this;
  78.     }
  79.     public function getSlug(): ?string
  80.     {
  81.         return $this->slug;
  82.     }
  83.     public function setSlug(?string $slug): self
  84.     {
  85.         $this->slug $slug;
  86.         return $this;
  87.     }
  88. }