src/Entity/Stock.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\StockRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=StockRepository::class)
  9.  */
  10. class Stock
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=55)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=TipoComida::class, inversedBy="stock")
  24.      */
  25.     private $type_food;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $description;
  30.     /**
  31.      * @ORM\Column(type="integer")
  32.      */
  33.     private $amount;
  34.     /**
  35.      * @ORM\ManyToOne(targetEntity=Comida::class, inversedBy="stock")
  36.      */
  37.     private $comida;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity=Productostienda::class, inversedBy="stocks")
  40.      */
  41.     private $producttienda;
  42.     public function __construct()
  43.     {
  44.         $this->type_food = new ArrayCollection();
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getName(): ?string
  51.     {
  52.         return $this->name;
  53.     }
  54.     public function setName(string $name): self
  55.     {
  56.         $this->name $name;
  57.         return $this;
  58.     }
  59.     /**
  60.      * @return TipoComida|null
  61.      */
  62.     public function getTypeFood()
  63.     {
  64.         return $this->type_food;
  65.     }
  66.     
  67.     public function setTypeFood(TipoCOmida $tf){
  68.         $this->type_food $tf;
  69.         return $this;
  70.     }
  71.     public function addTypeFood(TipoComida $typeFood): self
  72.     {
  73.         if (!$this->type_food->contains($typeFood)) {
  74.             $this->type_food[] = $typeFood;
  75.             $typeFood->setStock($this);
  76.         }
  77.         return $this;
  78.     }
  79.     public function removeTypeFood(TipoComida $typeFood): self
  80.     {
  81.         if ($this->type_food->removeElement($typeFood)) {
  82.             // set the owning side to null (unless already changed)
  83.             if ($typeFood->getStock() === $this) {
  84.                 $typeFood->setStock(null);
  85.             }
  86.         }
  87.         return $this;
  88.     }
  89.     public function getDescription(): ?string
  90.     {
  91.         return $this->description;
  92.     }
  93.     public function setDescription(?string $description): self
  94.     {
  95.         $this->description $description;
  96.         return $this;
  97.     }
  98.     public function getAmount(): ?int
  99.     {
  100.         return $this->amount;
  101.     }
  102.     public function setAmount(int $amount): self
  103.     {
  104.         $this->amount $amount;
  105.         return $this;
  106.     }
  107.     public function getComida(): ?Comida
  108.     {
  109.         return $this->comida;
  110.     }
  111.     public function setComida(?Comida $comida): self
  112.     {
  113.         $this->comida $comida;
  114.         return $this;
  115.     }
  116.     public function getProducttienda(): ?productostienda
  117.     {
  118.         return $this->producttienda;
  119.     }
  120.     public function setProducttienda(?productostienda $producttienda): self
  121.     {
  122.         $this->producttienda $producttienda;
  123.         return $this;
  124.     }
  125. }