src/Entity/Provider.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProviderRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ProviderRepository::class)
  9.  */
  10. class Provider
  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 $content;
  22.     /**
  23.      * @ORM\Column(type="boolean", nullable=true)
  24.      */
  25.     private $isActivo;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $slug;
  30.     /**
  31.      * @ORM\Column(type="string", length=2000, nullable=true)
  32.      */
  33.     private $description;
  34.     /**
  35.      * @ORM\Column(type="string", length=255, nullable=true)
  36.      */
  37.     private $location;
  38.     /**
  39.      * @ORM\Column(type="string", length=255, nullable=true)
  40.      */
  41.     private $subcontent;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity=ProviderType::class)
  44.      */
  45.     private $providerType;
  46.     /**
  47.      * @ORM\ManyToMany(targetEntity=Programa::class, mappedBy="provider")
  48.      */
  49.     private $programas;
  50.     /**
  51.      * @ORM\OneToMany(targetEntity=Discount::class, mappedBy="provider")
  52.      */
  53.     private $discounts;
  54.     /**
  55.      * @ORM\OneToMany(targetEntity=Solicitud::class, mappedBy="provider")
  56.      */
  57.     private $solicitudes;
  58.     /**
  59.      * @ORM\OneToMany(targetEntity=SolicitudPublica::class, mappedBy="proveedor")
  60.      */
  61.     private $solicitudesPublicas;
  62.     public function __construct()
  63.     {
  64.         $this->programas = new ArrayCollection();
  65.         $this->discounts = new ArrayCollection();
  66.         $this->solicitudes = new ArrayCollection();
  67.         $this->solicitudesPublicas = new ArrayCollection();
  68.     }
  69.     public function getId(): ?int
  70.     {
  71.         return $this->id;
  72.     }
  73.     public function getContent(): ?string
  74.     {
  75.         return $this->content;
  76.     }
  77.     public function setContent(string $content): self
  78.     {
  79.         $this->content $content;
  80.         return $this;
  81.     }
  82.     public function getIsActivo(): ?bool
  83.     {
  84.         return $this->isActivo;
  85.     }
  86.     public function setIsActivo(?bool $isActivo): self
  87.     {
  88.         $this->isActivo $isActivo;
  89.         return $this;
  90.     }
  91.     public function getSlug(): ?string
  92.     {
  93.         return $this->slug;
  94.     }
  95.     public function setSlug(?string $slug): self
  96.     {
  97.         $this->slug $slug;
  98.         return $this;
  99.     }
  100.     public function getDescription(): ?string
  101.     {
  102.         return $this->description;
  103.     }
  104.     public function setDescription(?string $description): self
  105.     {
  106.         $this->description $description;
  107.         return $this;
  108.     }
  109.     public function getLocation(): ?string
  110.     {
  111.         return $this->location;
  112.     }
  113.     public function setLocation(?string $location): self
  114.     {
  115.         $this->location $location;
  116.         return $this;
  117.     }
  118.     public function getSubcontent(): ?string
  119.     {
  120.         return $this->subcontent;
  121.     }
  122.     public function setSubcontent(?string $subcontent): self
  123.     {
  124.         $this->subcontent $subcontent;
  125.         return $this;
  126.     }
  127.     public function getProviderType(): ?ProviderType
  128.     {
  129.         return $this->providerType;
  130.     }
  131.     public function setProviderType(?ProviderType $providerType): self
  132.     {
  133.         $this->providerType $providerType;
  134.         return $this;
  135.     }
  136.     /**
  137.      * @return Collection<int, Programa>
  138.      */
  139.     public function getProgramas(): Collection
  140.     {
  141.         return $this->programas;
  142.     }
  143.     public function addPrograma(Programa $programa): self
  144.     {
  145.         if (!$this->programas->contains($programa)) {
  146.             $this->programas[] = $programa;
  147.             $programa->addProvider($this);
  148.         }
  149.         return $this;
  150.     }
  151.     public function removePrograma(Programa $programa): self
  152.     {
  153.         if ($this->programas->removeElement($programa)) {
  154.             $programa->removeProvider($this);
  155.         }
  156.         return $this;
  157.     }
  158.     public function __toString()
  159.     {
  160.         return $this->getProviderType(). ' ' $this->content ' ' $this->getSubcontent() . ' ' $this->getLocation();
  161.     }
  162.     public function getNombre($type): ?string
  163.     {
  164.         switch ($type){
  165.             case 1:
  166.                 return $this->getProviderType(). ' ' $this->content ' ' $this->getSubcontent();
  167.                 break;
  168.             case 2:
  169.                 return $this->content ', ' $this->getLocation();
  170.                 break;
  171.             default:
  172.                 return $this->content ' ' $this->getSubcontent();
  173.                 break;
  174.         }
  175.     }
  176.     public function getNombreLocation(): ?string
  177.     {
  178.         return $this->content ' ' $this->getLocation();
  179.     }
  180.     /**
  181.      * @return Collection<int, Discount>
  182.      */
  183.     public function getDiscounts(): Collection
  184.     {
  185.         return $this->discounts;
  186.     }
  187.     public function addDiscount(Discount $discount): self
  188.     {
  189.         if (!$this->discounts->contains($discount)) {
  190.             $this->discounts[] = $discount;
  191.             $discount->setProvider($this);
  192.         }
  193.         return $this;
  194.     }
  195.     public function removeDiscount(Discount $discount): self
  196.     {
  197.         if ($this->discounts->removeElement($discount)) {
  198.             // set the owning side to null (unless already changed)
  199.             if ($discount->getProvider() === $this) {
  200.                 $discount->setProvider(null);
  201.             }
  202.         }
  203.         return $this;
  204.     }
  205.     /**
  206.      * @return Collection<int, Solicitud>
  207.      */
  208.     public function getSolicitudes(): Collection
  209.     {
  210.         return $this->solicitudes;
  211.     }
  212.     public function addSolicitude(Solicitud $solicitude): self
  213.     {
  214.         if (!$this->solicitudes->contains($solicitude)) {
  215.             $this->solicitudes[] = $solicitude;
  216.             $solicitude->setProvider($this);
  217.         }
  218.         return $this;
  219.     }
  220.     public function removeSolicitude(Solicitud $solicitude): self
  221.     {
  222.         if ($this->solicitudes->removeElement($solicitude)) {
  223.             // set the owning side to null (unless already changed)
  224.             if ($solicitude->getProvider() === $this) {
  225.                 $solicitude->setProvider(null);
  226.             }
  227.         }
  228.         return $this;
  229.     }
  230.     /**
  231.      * @return Collection<int, SolicitudPublica>
  232.      */
  233.     public function getSolicitudesPublicas(): Collection
  234.     {
  235.         return $this->solicitudesPublicas;
  236.     }
  237.     public function addSolicitudesPublica(SolicitudPublica $solicitudesPublica): self
  238.     {
  239.         if (!$this->solicitudesPublicas->contains($solicitudesPublica)) {
  240.             $this->solicitudesPublicas[] = $solicitudesPublica;
  241.             $solicitudesPublica->setProveedor($this);
  242.         }
  243.         return $this;
  244.     }
  245.     public function removeSolicitudesPublica(SolicitudPublica $solicitudesPublica): self
  246.     {
  247.         if ($this->solicitudesPublicas->removeElement($solicitudesPublica)) {
  248.             // set the owning side to null (unless already changed)
  249.             if ($solicitudesPublica->getProveedor() === $this) {
  250.                 $solicitudesPublica->setProveedor(null);
  251.             }
  252.         }
  253.         return $this;
  254.     }
  255. }