<?php
namespace App\Entity;
use App\Repository\CalculatorRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use \Gedmo\Timestampable\Traits\TimestampableEntity;
/**
* @ORM\Entity(repositoryClass=CalculatorRepository::class)
*/
class Calculator
{
use TimestampableEntity;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $template;
/**
* @ORM\OneToMany(targetEntity=PriceMatrix::class, mappedBy="calculator", cascade={"persist"})
*/
private $priceMatrices;
public function __construct()
{
$this->priceMatrices = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getTemplate(): ?string
{
return $this->template;
}
public function setTemplate(?string $template): self
{
$this->template = $template;
return $this;
}
/**
* @return Collection<int, PriceMatrix>
*/
public function getPriceMatrices(): Collection
{
return $this->priceMatrices;
}
public function addPriceMatrix(PriceMatrix $priceMatrix): self
{
if (!$this->priceMatrices->contains($priceMatrix)) {
$this->priceMatrices[] = $priceMatrix;
$priceMatrix->setCalculator($this);
}
return $this;
}
public function removePriceMatrix(PriceMatrix $priceMatrix): self
{
if ($this->priceMatrices->removeElement($priceMatrix)) {
// set the owning side to null (unless already changed)
if ($priceMatrix->getCalculator() === $this) {
$priceMatrix->setCalculator(null);
}
}
return $this;
}
}