src/Entity/ServiceFocusPub.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ServiceFocusPubRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. /**
  10.  * @Vich\Uploadable
  11.  */
  12. #[ORM\Entity(repositoryClassServiceFocusPubRepository::class)]
  13. class ServiceFocusPub implements \Stringable
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column(type'integer')]
  18.     private int $id;
  19.     #[ORM\Column(type'string'length255nullabletrue)]
  20.     private ?string $titrenull;
  21.     #[ORM\Column(type'string'length255nullabletrue)]
  22.     private ?string $image_namenull;
  23.     /**
  24.      * @Vich\UploadableField(mapping="images", fileNameProperty="image_name")
  25.      */
  26.     private ?\Symfony\Component\HttpFoundation\File\File $image null;
  27.     #[ORM\Column(type'string'length255nullabletrue)]
  28.     private ?string $image_urlnull;
  29.     #[ORM\ManyToMany(targetEntityServiceGrandProfil::class, inversedBy'serviceFocusPubs')]
  30.     private mixed $grandprofils;
  31.     #[ORM\ManyToMany(targetEntityServiceSousProfil::class, inversedBy'serviceFocusPubs')]
  32.     private mixed $sousprofils;
  33.     #[ORM\ManyToMany(targetEntityServiceTheme::class, inversedBy'serviceFocusPubs')]
  34.     private mixed $themes;
  35.     #[ORM\Column(type'text'nullabletrue)]
  36.     private ?string $descriptionnull;
  37.     #[ORM\Column(type'string'length255nullabletrue)]
  38.     private ?string $urlnull;
  39.     #[ORM\Column(type'datetime'nullabletrue)]
  40.     private mixed $date_update;
  41.     public function __construct()
  42.     {
  43.         $this->grandprofils = new ArrayCollection();
  44.         $this->sousprofils = new ArrayCollection();
  45.         $this->themes = new ArrayCollection();
  46.     }
  47.     public function setImage(File $file null): void
  48.     {
  49.         $this->image $file;
  50.         if ($file) {
  51.             $this->date_update = new \DateTime;
  52.         }
  53.     }
  54.     public function getImage(): mixed
  55.     {
  56.         return $this->image;
  57.     }
  58.     public function getId(): ?int
  59.     {
  60.         return $this->id;
  61.     }
  62.     public function getTitre(): ?string
  63.     {
  64.         return $this->titre;
  65.     }
  66.     public function setTitre(?string $titre): self
  67.     {
  68.         $this->titre $titre;
  69.         return $this;
  70.     }
  71.     public function getImageName(): ?string
  72.     {
  73.         return $this->image_name;
  74.     }
  75.     public function setImageName(?string $image_name): self
  76.     {
  77.         $this->image_name $image_name;
  78.         return $this;
  79.     }
  80.     public function getImageUrl(): ?string
  81.     {
  82.         return $this->image_url;
  83.     }
  84.     public function setImageUrl(?string $image_url): self
  85.     {
  86.         $this->image_url $image_url;
  87.         return $this;
  88.     }
  89.     /**
  90.      * @return Collection|ServiceGrandProfil[]
  91.      */
  92.     public function getGrandprofils(): Collection
  93.     {
  94.         return $this->grandprofils;
  95.     }
  96.     public function addGrandprofil(ServiceGrandProfil $grandprofil): self
  97.     {
  98.         if (!$this->grandprofils->contains($grandprofil)) {
  99.             $this->grandprofils[] = $grandprofil;
  100.         }
  101.         return $this;
  102.     }
  103.     public function removeGrandprofil(ServiceGrandProfil $grandprofil): self
  104.     {
  105.         $this->grandprofils->removeElement($grandprofil);
  106.         return $this;
  107.     }
  108.     /**
  109.      * @return Collection|ServiceSousProfil[]
  110.      */
  111.     public function getSousprofils(): Collection
  112.     {
  113.         return $this->sousprofils;
  114.     }
  115.     public function addSousprofil(ServiceSousProfil $sousprofil): self
  116.     {
  117.         if (!$this->sousprofils->contains($sousprofil)) {
  118.             $this->sousprofils[] = $sousprofil;
  119.         }
  120.         return $this;
  121.     }
  122.     public function removeSousprofil(ServiceSousProfil $sousprofil): self
  123.     {
  124.         $this->sousprofils->removeElement($sousprofil);
  125.         return $this;
  126.     }
  127.     /**
  128.      * @return Collection|ServiceTheme[]
  129.      */
  130.     public function getThemes(): Collection
  131.     {
  132.         return $this->themes;
  133.     }
  134.     public function addTheme(ServiceTheme $theme): self
  135.     {
  136.         if (!$this->themes->contains($theme)) {
  137.             $this->themes[] = $theme;
  138.         }
  139.         return $this;
  140.     }
  141.     public function removeTheme(ServiceTheme $theme): self
  142.     {
  143.         $this->themes->removeElement($theme);
  144.         return $this;
  145.     }
  146.     public function getDescription(): ?string
  147.     {
  148.         return $this->description;
  149.     }
  150.     public function setDescription(?string $description): self
  151.     {
  152.         $this->description $description;
  153.         return $this;
  154.     }
  155.     public function getUrl(): ?string
  156.     {
  157.         return $this->url;
  158.     }
  159.     public function setUrl(?string $url): self
  160.     {
  161.         $this->url $url;
  162.         return $this;
  163.     }
  164.     public function getDateUpdate(): ?\DateTimeInterface
  165.     {
  166.         return $this->date_update;
  167.     }
  168.     public function setDateUpdate(?\DateTimeInterface $date_update): self
  169.     {
  170.         $this->date_update $date_update;
  171.         return $this;
  172.     }
  173.     public function __toString(): string
  174.     {
  175.         return (string) $this->titre;
  176.     }
  177. }