src/Entity/Calculator.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CalculatorRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use \Gedmo\Timestampable\Traits\TimestampableEntity;
  8. /**
  9.  * @ORM\Entity(repositoryClass=CalculatorRepository::class)
  10.  */
  11. class Calculator
  12. {
  13.     use TimestampableEntity;
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255)
  22.      */
  23.     private $name;
  24.     /**
  25.      * @ORM\Column(type="text", nullable=true)
  26.      */
  27.     private $description;
  28.     /**
  29.      * @ORM\Column(type="string", length=255, nullable=true)
  30.      */
  31.     private $template;
  32.     /**
  33.      * @ORM\OneToMany(targetEntity=PriceMatrix::class, mappedBy="calculator", cascade={"persist"})
  34.      */
  35.     private $priceMatrices;
  36.     public function __construct()
  37.     {
  38.         $this->priceMatrices = new ArrayCollection();
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getName(): ?string
  45.     {
  46.         return $this->name;
  47.     }
  48.     public function setName(string $name): self
  49.     {
  50.         $this->name $name;
  51.         return $this;
  52.     }
  53.     public function getDescription(): ?string
  54.     {
  55.         return $this->description;
  56.     }
  57.     public function setDescription(?string $description): self
  58.     {
  59.         $this->description $description;
  60.         return $this;
  61.     }
  62.     public function getTemplate(): ?string
  63.     {
  64.         return $this->template;
  65.     }
  66.     public function setTemplate(?string $template): self
  67.     {
  68.         $this->template $template;
  69.         return $this;
  70.     }
  71.     /**
  72.      * @return Collection<int, PriceMatrix>
  73.      */
  74.     public function getPriceMatrices(): Collection
  75.     {
  76.         return $this->priceMatrices;
  77.     }
  78.     public function addPriceMatrix(PriceMatrix $priceMatrix): self
  79.     {
  80.         if (!$this->priceMatrices->contains($priceMatrix)) {
  81.             $this->priceMatrices[] = $priceMatrix;
  82.             $priceMatrix->setCalculator($this);
  83.         }
  84.         return $this;
  85.     }
  86.     public function removePriceMatrix(PriceMatrix $priceMatrix): self
  87.     {
  88.         if ($this->priceMatrices->removeElement($priceMatrix)) {
  89.             // set the owning side to null (unless already changed)
  90.             if ($priceMatrix->getCalculator() === $this) {
  91.                 $priceMatrix->setCalculator(null);
  92.             }
  93.         }
  94.         return $this;
  95.     }
  96. }