src/Entity/Service.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ServiceRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ServiceRepository::class)
  9.  */
  10. class Service
  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, nullable=true)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="text", nullable=true)
  24.      */
  25.     private $description;
  26.     /**
  27.      * @ORM\Column(type="boolean", nullable=true)
  28.      */
  29.     private $status;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private $image;
  34.     /**
  35.      * @ORM\Column(type="datetime_immutable", nullable=true)
  36.      */
  37.     private $createdAt;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity=CategoryServices::class, inversedBy="services")
  40.      */
  41.     private $categoryService;
  42.     /**
  43.      * @ORM\OneToMany(targetEntity=Portfolio::class, mappedBy="service")
  44.      */
  45.     private $portfolios;
  46.     /**
  47.      * @ORM\OneToMany(targetEntity=Reservation::class, mappedBy="service")
  48.      */
  49.     private $reservations;
  50.     /**
  51.      * @ORM\Column(type="string", length=255, nullable=true)
  52.      */
  53.     private $slug;
  54.     /**
  55.      * @ORM\OneToMany(targetEntity=Album::class, mappedBy="service")
  56.      */
  57.     private $albums;
  58.     /**
  59.      * @ORM\Column(type="string", length=255, nullable=true)
  60.      */
  61.     private $slogan;
  62.     /**
  63.      * @ORM\Column(type="string", length=255, nullable=true)
  64.      */
  65.     private $cover;
  66.     public function __construct()
  67.     {
  68.         $this->portfolios = new ArrayCollection();
  69.         $this->reservations = new ArrayCollection();
  70.         $this->albums = new ArrayCollection();
  71.     }
  72.     public function getId(): ?int
  73.     {
  74.         return $this->id;
  75.     }
  76.     public function getName(): ?string
  77.     {
  78.         return $this->name;
  79.     }
  80.     public function setName(?string $name): self
  81.     {
  82.         $this->name $name;
  83.         return $this;
  84.     }
  85.     public function getDescription(): ?string
  86.     {
  87.         return $this->description;
  88.     }
  89.     public function setDescription(?string $description): self
  90.     {
  91.         $this->description $description;
  92.         return $this;
  93.     }
  94.     public function isStatus(): ?bool
  95.     {
  96.         return $this->status;
  97.     }
  98.     public function setStatus(?bool $status): self
  99.     {
  100.         $this->status $status;
  101.         return $this;
  102.     }
  103.     public function getImage(): ?string
  104.     {
  105.         return $this->image;
  106.     }
  107.     public function setImage(?string $image): self
  108.     {
  109.         $this->image $image;
  110.         return $this;
  111.     }
  112.     public function getCreatedAt(): ?\DateTimeImmutable
  113.     {
  114.         return $this->createdAt;
  115.     }
  116.     public function setCreatedAt(?\DateTimeImmutable $createdAt): self
  117.     {
  118.         $this->createdAt $createdAt;
  119.         return $this;
  120.     }
  121.     public function getCategoryService(): ?CategoryServices
  122.     {
  123.         return $this->categoryService;
  124.     }
  125.     public function setCategoryService(?CategoryServices $categoryService): self
  126.     {
  127.         $this->categoryService $categoryService;
  128.         return $this;
  129.     }
  130.     /**
  131.      * @return Collection<int, Portfolio>
  132.      */
  133.     public function getPortfolios(): Collection
  134.     {
  135.         return $this->portfolios;
  136.     }
  137.     public function addPortfolio(Portfolio $portfolio): self
  138.     {
  139.         if (!$this->portfolios->contains($portfolio)) {
  140.             $this->portfolios[] = $portfolio;
  141.             $portfolio->setService($this);
  142.         }
  143.         return $this;
  144.     }
  145.     public function removePortfolio(Portfolio $portfolio): self
  146.     {
  147.         if ($this->portfolios->removeElement($portfolio)) {
  148.             // set the owning side to null (unless already changed)
  149.             if ($portfolio->getService() === $this) {
  150.                 $portfolio->setService(null);
  151.             }
  152.         }
  153.         return $this;
  154.     }
  155.     /**
  156.      * @return Collection<int, Reservation>
  157.      */
  158.     public function getReservations(): Collection
  159.     {
  160.         return $this->reservations;
  161.     }
  162.     public function addReservation(Reservation $reservation): self
  163.     {
  164.         if (!$this->reservations->contains($reservation)) {
  165.             $this->reservations[] = $reservation;
  166.             $reservation->setService($this);
  167.         }
  168.         return $this;
  169.     }
  170.     public function removeReservation(Reservation $reservation): self
  171.     {
  172.         if ($this->reservations->removeElement($reservation)) {
  173.             // set the owning side to null (unless already changed)
  174.             if ($reservation->getService() === $this) {
  175.                 $reservation->setService(null);
  176.             }
  177.         }
  178.         return $this;
  179.     }
  180.     public function getSlug(): ?string
  181.     {
  182.         return $this->slug;
  183.     }
  184.     public function setSlug(?string $slug): self
  185.     {
  186.         $this->slug $slug;
  187.         return $this;
  188.     }
  189.     /**
  190.      * @return Collection<int, Album>
  191.      */
  192.     public function getAlbums(): Collection
  193.     {
  194.         return $this->albums;
  195.     }
  196.     public function addAlbum(Album $album): self
  197.     {
  198.         if (!$this->albums->contains($album)) {
  199.             $this->albums[] = $album;
  200.             $album->setService($this);
  201.         }
  202.         return $this;
  203.     }
  204.     public function removeAlbum(Album $album): self
  205.     {
  206.         if ($this->albums->removeElement($album)) {
  207.             // set the owning side to null (unless already changed)
  208.             if ($album->getService() === $this) {
  209.                 $album->setService(null);
  210.             }
  211.         }
  212.         return $this;
  213.     }
  214.     public function getSlogan(): ?string
  215.     {
  216.         return $this->slogan;
  217.     }
  218.     public function setSlogan(?string $slogan): self
  219.     {
  220.         $this->slogan $slogan;
  221.         return $this;
  222.     }
  223.     public function getCover(): ?string
  224.     {
  225.         return $this->cover;
  226.     }
  227.     public function setCover(?string $cover): self
  228.     {
  229.         $this->cover $cover;
  230.         return $this;
  231.     }
  232.     public function __toString(): string
  233.     {
  234.         return $this->name ?: 'Album';
  235.     }
  236. }