src/Entity/Item.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ItemRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ItemRepository::class)
  10.  */
  11. class Item
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(name="id", type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @var string
  21.      * @ORM\Column(name="label", type="string", length=180)
  22.      */
  23.     private $label;
  24.     /**
  25.      * @var double
  26.      * @ORM\Column(name="price", type="decimal", precision=10, scale=2)
  27.      */
  28.     private $price;
  29.     /**
  30.      * @var Category
  31.      *
  32.      * @ORM\ManyToOne(targetEntity="Category", fetch="EAGER")
  33.      * @ORM\JoinColumns({
  34.      *   @ORM\JoinColumn(name="category_id", referencedColumnName="id")
  35.      * })
  36.      */
  37.     private $categoryId;
  38.     /**
  39.      * @var string|null
  40.      *
  41.      * @ORM\Column(name="image", type="string", length="500", nullable=true)
  42.      */
  43.     private $image;
  44.     /**
  45.      * @var string|null
  46.      *
  47.      * @ORM\Column(name="imagemini", type="string", length="500", nullable=true)
  48.      */
  49.     private $imagemini;
  50.     /**
  51.      * @var Collection
  52.      *
  53.      * @ORM\ManyToMany(targetEntity="Criterion", fetch="EAGER")
  54.      * @ORM\JoinTable(name="item_criterion",
  55.      *      joinColumns={@ORM\JoinColumn(name="item_id", referencedColumnName="id")},
  56.      *      inverseJoinColumns={@ORM\JoinColumn(name="criterion_id", referencedColumnName="id")}
  57.      *      )
  58.      */
  59.     private $criterion;
  60.     public function __construct()
  61.     {
  62.         $this->criterion = new ArrayCollection();
  63.     }
  64.     /**
  65.      * @return integer
  66.      */
  67.     public function getId()
  68.     {
  69.         return $this->id;
  70.     }
  71.     /**
  72.      * @param integer $id
  73.      */
  74.     public function setId($id): void
  75.     {
  76.         $this->id $id;
  77.     }
  78.     /**
  79.      * @return string
  80.      */
  81.     public function getLabel(): string
  82.     {
  83.         return $this->label;
  84.     }
  85.     /**
  86.      * @param string $label
  87.      */
  88.     public function setLabel(string $label): void
  89.     {
  90.         $this->label $label;
  91.     }
  92.     /**
  93.      * @return float
  94.      */
  95.     public function getPrice(): float
  96.     {
  97.         return $this->price;
  98.     }
  99.     /**
  100.      * @param float $price
  101.      */
  102.     public function setPrice(float $price): void
  103.     {
  104.         $this->price $price;
  105.     }
  106.     /**
  107.      * @return Category
  108.      */
  109.     public function getCategoryId(): ?Category
  110.     {
  111.         return $this->categoryId;
  112.     }
  113.     /**
  114.      * @param Category $categoryId
  115.      */
  116.     public function setCategoryId(Category $categoryId): void
  117.     {
  118.         $this->categoryId $categoryId;
  119.     }
  120.     /**
  121.      * @return string|null
  122.      */
  123.     public function getImage(): ?string
  124.     {
  125.         return $this->image;
  126.     }
  127.     /**
  128.      * @param string|null $image
  129.      */
  130.     public function setImage(?string $image): void
  131.     {
  132.         $this->image $image;
  133.     }
  134.     /**
  135.      * @return string|null
  136.      */
  137.     public function getImagemini(): ?string
  138.     {
  139.         return $this->imagemini;
  140.     }
  141.     /**
  142.      * @param string|null $imagemini
  143.      */
  144.     public function setImagemini(?string $imagemini): void
  145.     {
  146.         $this->imagemini $imagemini;
  147.     }
  148.     /**
  149.      * @return Collection
  150.      */
  151.     public function getCriterion(): Collection
  152.     {
  153.         return $this->criterion;
  154.     }
  155.     /**
  156.      * @param Collection $criterion
  157.      */
  158.     public function setCriterion(Collection $criterion): void
  159.     {
  160.         $this->criterion $criterion;
  161.     }
  162.     /**
  163.      * @param Criterion $criterion
  164.      */
  165.     public function addCriterion(Criterion $criterion): void
  166.     {
  167.         if (!$this->criterion->contains($criterion)) {
  168.             $this->criterion->add($criterion);
  169.         }
  170.     }
  171.     /**
  172.      * @param Criterion $criterion
  173.      */
  174.     public function removeCriterion(Criterion $criterion): void
  175.     {
  176.         $this->criterion->removeElement($criterion);
  177.     }
  178. }