src/Entity/TipoComida.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TipoComidaRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=TipoComidaRepository::class)
  9.  */
  10. class TipoComida
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=50)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\OneToMany(targetEntity=Stock::class, mappedBy="type_food")
  24.      */
  25.     private $stock;
  26.     /**
  27.      * @ORM\Column(type="string", length=50, nullable=true)
  28.      */
  29.     private $icon;
  30.     /**
  31.      * @ORM\OneToMany(targetEntity=Comida::class, mappedBy="type_food")
  32.      */
  33.     private $comida;
  34.     /**
  35.      * @ORM\Column(type="boolean")
  36.      */
  37.     private $active;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity=Statscomida::class, mappedBy="tipocomida")
  40.      */
  41.     private $statscomidas;
  42.     /**
  43.      * @ORM\Column(type="string", length=255, nullable=true)
  44.      */
  45.     private $ruta_img;
  46.     public function __construct()
  47.     {
  48.         $this->comida = new ArrayCollection();
  49.         $this->statscomidas = new ArrayCollection();
  50.     }
  51.     public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function getName(): ?string
  56.     {
  57.         return $this->name;
  58.     }
  59.     public function setName(string $name): self
  60.     {
  61.         $this->name $name;
  62.         return $this;
  63.     }
  64.     public function getStock(): ?Stock
  65.     {
  66.         return $this->stock;
  67.     }
  68.     public function setStock(?Stock $stock): self
  69.     {
  70.         $this->stock $stock;
  71.         return $this;
  72.     }
  73.     public function getIcon(): ?string
  74.     {
  75.         return $this->icon;
  76.     }
  77.     public function setIcon(?string $icon): self
  78.     {
  79.         $this->icon $icon;
  80.         return $this;
  81.     }
  82.     /**
  83.      * @return Collection<int, Comida>
  84.      */
  85.     public function getComida(): Collection
  86.     {
  87.         return $this->comida;
  88.     }
  89.     public function addComida(Comida $comida): self
  90.     {
  91.         if (!$this->comida->contains($comida)) {
  92.             $this->comida[] = $comida;
  93.             $comida->setTypeFood($this);
  94.         }
  95.         return $this;
  96.     }
  97.     public function removeComida(Comida $comida): self
  98.     {
  99.         if ($this->comida->removeElement($comida)) {
  100.             // set the owning side to null (unless already changed)
  101.             if ($comida->getTypeFood() === $this) {
  102.                 $comida->setTypeFood(null);
  103.             }
  104.         }
  105.         return $this;
  106.     }
  107.     public function isActive(): ?bool
  108.     {
  109.         return $this->active;
  110.     }
  111.     public function setActive(bool $active): self
  112.     {
  113.         $this->active $active;
  114.         return $this;
  115.     }
  116.     /**
  117.      * @return Collection<int, Statscomida>
  118.      */
  119.     public function getStatscomidas(): Collection
  120.     {
  121.         return $this->statscomidas;
  122.     }
  123.     public function addStatscomida(Statscomida $statscomida): self
  124.     {
  125.         if (!$this->statscomidas->contains($statscomida)) {
  126.             $this->statscomidas[] = $statscomida;
  127.             $statscomida->setTipocomida($this);
  128.         }
  129.         return $this;
  130.     }
  131.     public function removeStatscomida(Statscomida $statscomida): self
  132.     {
  133.         if ($this->statscomidas->removeElement($statscomida)) {
  134.             // set the owning side to null (unless already changed)
  135.             if ($statscomida->getTipocomida() === $this) {
  136.                 $statscomida->setTipocomida(null);
  137.             }
  138.         }
  139.         return $this;
  140.     }
  141.     public function getRutaImg(): ?string
  142.     {
  143.         return $this->ruta_img;
  144.     }
  145.     public function setRutaImg(?string $ruta_img): self
  146.     {
  147.         $this->ruta_img $ruta_img;
  148.         return $this;
  149.     }
  150. }