src/Entity/Measurements.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\MeasurementsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassMeasurementsRepository::class)]
  8. class Measurements extends BaseEntity
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'string'length255)]
  15.     private $name;
  16.     #[ORM\Column(type'string'length255)]
  17.     private $measurement;
  18.     #[ORM\OneToMany(mappedBy'measurement'targetEntityProduct::class)]
  19.     private $products;
  20.     #[ORM\Column(type'float')]
  21.     private $length;
  22.     #[ORM\Column(type'float')]
  23.     private $width;
  24.     #[ORM\Column(type'float')]
  25.     private $thickness;
  26.     #[ORM\OneToMany(mappedBy'measurement'targetEntityMeasurementConversions::class)]
  27.     private Collection $conversions;
  28.     public function __construct()
  29.     {
  30.         $this->products = new ArrayCollection();
  31.         $this->conversions = new ArrayCollection();
  32.     }
  33.     public function __invoke()
  34.     {
  35.         return $this->getId();
  36.     }
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     public function getName(): ?string
  42.     {
  43.         return $this->name;
  44.     }
  45.     public function setName(string $name): self
  46.     {
  47.         $this->name $name;
  48.         return $this;
  49.     }
  50.     public function getMeasurement(): ?string
  51.     {
  52.         return $this->measurement;
  53.     }
  54.     public function setMeasurement(string $measurement): self
  55.     {
  56.         $this->measurement $measurement;
  57.         return $this;
  58.     }
  59.     /**
  60.      * @return Collection<int, Product>
  61.      */
  62.     public function getProducts(): Collection
  63.     {
  64.         return $this->products;
  65.     }
  66.     public function addProduct(Product $product): self
  67.     {
  68.         if (!$this->products->contains($product)) {
  69.             $this->products[] = $product;
  70.             $product->setMeasurement($this);
  71.         }
  72.         return $this;
  73.     }
  74.     public function removeProduct(Product $product): self
  75.     {
  76.         if ($this->products->removeElement($product)) {
  77.             // set the owning side to null (unless already changed)
  78.             if ($product->getMeasurement() === $this) {
  79.                 $product->setMeasurement(null);
  80.             }
  81.         }
  82.         return $this;
  83.     }
  84.     public function getLength(): ?float
  85.     {
  86.         return $this->length;
  87.     }
  88.     public function setLength(float $length): self
  89.     {
  90.         $this->length $length;
  91.         return $this;
  92.     }
  93.     public function getWidth(): ?float
  94.     {
  95.         return $this->width;
  96.     }
  97.     public function setWidth(float $width): self
  98.     {
  99.         $this->width $width;
  100.         return $this;
  101.     }
  102.     public function getThickness(): ?float
  103.     {
  104.         return $this->thickness;
  105.     }
  106.     public function setThickness(float $thickness): self
  107.     {
  108.         $this->thickness $thickness;
  109.         return $this;
  110.     }
  111.     public function getConversions(): Collection
  112.     {
  113.         return $this->conversions;
  114.     }
  115.     public function setConversions(Collection $conversions): void
  116.     {
  117.         $this->conversions $conversions;
  118.     }
  119. }