src/Entity/Projet.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProjetRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\HasLifecycleCallbacks()
  9.  * @ORM\Entity(repositoryClass=ProjetRepository::class)
  10.  */
  11. class Projet
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="text", nullable=true)
  21.      */
  22.     private $themeCss;
  23.     /**
  24.      * @ORM\Column(type="string", length=255, nullable=true)
  25.      */
  26.     private $banner;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity=Client::class, inversedBy="projets")
  29.      */
  30.     private $client;
  31.     /**
  32.      * @ORM\Column(type="datetime", nullable=true)
  33.      */
  34.     private $createdAt;
  35.     /**
  36.      * @ORM\Column(type="datetime")
  37.      */
  38.     private $updatedAt;
  39.     /**
  40.      * @ORM\Column(type="string", length=255)
  41.      */
  42.     private $name;
  43.     /**
  44.      * @ORM\ManyToMany(targetEntity=Rubrique::class, mappedBy="projet")
  45.      */
  46.     private $rubriques;
  47.     /**
  48.      * @ORM\OneToMany(targetEntity=ClientProduit::class, mappedBy="projet")
  49.      */
  50.     private $clientProduits;
  51.     /**
  52.      * @ORM\OneToMany(targetEntity=Groupe::class, mappedBy="projet")
  53.      */
  54.     private $groupes;
  55.     public function __construct()
  56.     {
  57.         $this->rubriques = new ArrayCollection();
  58.         $this->clientProduits = new ArrayCollection();
  59.         $this->groupes = new ArrayCollection();
  60.     }
  61.     public function getId(): ?int
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function getThemeCss(): ?string
  66.     {
  67.         return $this->themeCss;
  68.     }
  69.     public function setThemeCss(?string $themeCss): self
  70.     {
  71.         $this->themeCss $themeCss;
  72.         return $this;
  73.     }
  74.     public function getBanner(): ?string
  75.     {
  76.         return $this->banner;
  77.     }
  78.     public function setBanner(?string $banner): self
  79.     {
  80.         $this->banner $banner;
  81.         return $this;
  82.     }
  83.     public function getClient(): ?Client
  84.     {
  85.         return $this->client;
  86.     }
  87.     public function setClient(?Client $client): self
  88.     {
  89.         $this->client $client;
  90.         return $this;
  91.     }
  92.     public function getCreatedAt(): ?\DateTimeInterface
  93.     {
  94.         return $this->createdAt;
  95.     }
  96.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  97.     {
  98.         $this->createdAt $createdAt;
  99.         return $this;
  100.     }
  101.     public function getUpdatedAt(): ?\DateTimeInterface
  102.     {
  103.         return $this->updatedAt;
  104.     }
  105.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  106.     {
  107.         $this->updatedAt $updatedAt;
  108.         return $this;
  109.     }
  110.     public function getName(): ?string
  111.     {
  112.         return $this->name;
  113.     }
  114.     public function setName(string $name): self
  115.     {
  116.         $this->name $name;
  117.         return $this;
  118.     }
  119.     /**
  120.      * @ORM\PrePersist
  121.      * @ORM\PreUpdate
  122.      */
  123.     public function updateTimer()
  124.     {
  125.         if ($this->getCreatedAt() == null) {
  126.             $this->setCreatedAt(new \DateTime());
  127.         }
  128.         $this->setUpdatedAt(new \DateTime());
  129.     }
  130.     /**
  131.      * @return Collection|Rubrique[]
  132.      */
  133.     public function getRubriques(): Collection
  134.     {
  135.         return $this->rubriques;
  136.     }
  137.     public function addRubrique(Rubrique $rubrique): self
  138.     {
  139.         if (!$this->rubriques->contains($rubrique)) {
  140.             $this->rubriques[] = $rubrique;
  141.             $rubrique->addProjet($this);
  142.         }
  143.         return $this;
  144.     }
  145.     public function removeRubrique(Rubrique $rubrique): self
  146.     {
  147.         if ($this->rubriques->removeElement($rubrique)) {
  148.             $rubrique->removeProjet($this);
  149.         }
  150.         return $this;
  151.     }
  152.     /**
  153.      * @return Collection|ClientProduit[]
  154.      */
  155.     public function getClientProduits(): Collection
  156.     {
  157.         return $this->clientProduits;
  158.     }
  159.     public function addClientProduit(ClientProduit $clientProduit): self
  160.     {
  161.         if (!$this->clientProduits->contains($clientProduit)) {
  162.             $this->clientProduits[] = $clientProduit;
  163.             $clientProduit->setProjet($this);
  164.         }
  165.         return $this;
  166.     }
  167.     public function removeClientProduit(ClientProduit $clientProduit): self
  168.     {
  169.         if ($this->clientProduits->removeElement($clientProduit)) {
  170.             // set the owning side to null (unless already changed)
  171.             if ($clientProduit->getProjet() === $this) {
  172.                 $clientProduit->setProjet(null);
  173.             }
  174.         }
  175.         return $this;
  176.     }
  177.     /**
  178.      * @return Collection|Groupe[]
  179.      */
  180.     public function getGroupes(): Collection
  181.     {
  182.         return $this->groupes;
  183.     }
  184.     public function addGroupe(Groupe $groupe): self
  185.     {
  186.         if (!$this->groupes->contains($groupe)) {
  187.             $this->groupes[] = $groupe;
  188.             $groupe->setProjet($this);
  189.         }
  190.         return $this;
  191.     }
  192.     public function removeGroupe(Groupe $groupe): self
  193.     {
  194.         if ($this->groupes->removeElement($groupe)) {
  195.             // set the owning side to null (unless already changed)
  196.             if ($groupe->getProjet() === $this) {
  197.                 $groupe->setProjet(null);
  198.             }
  199.         }
  200.         return $this;
  201.     }
  202. }