src/Entity/MachinePaperSizeMatrix.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\MachinePaperSizeMatrixRepository;
  4. use DateTime;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Gedmo\Timestampable\Traits\TimestampableEntity;
  9. /**
  10.  * @ORM\Entity(repositoryClass=MachinePaperSizeMatrixRepository::class)
  11.  */
  12. class MachinePaperSizeMatrix
  13. {
  14.     use TimestampableEntity;
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="integer")
  23.      */
  24.     private $setup;
  25.     /**
  26.      * @ORM\ManyToOne(targetEntity=Machine::class, inversedBy="machinePaperSizeMatrices")
  27.      * @ORM\JoinColumn(nullable=false)
  28.      */
  29.     private $machine;
  30.     /**
  31.      * @ORM\ManyToOne(targetEntity=PaperSize::class, inversedBy="machinePaperSizeMatrices")
  32.      * @ORM\JoinColumn(nullable=false)
  33.      */
  34.     private $paperSize;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=MachinePaperSizeCostMatrix::class, mappedBy="machinePaperSizeMatrix",
  37.      *     orphanRemoval=true, cascade={"persist", "remove"})
  38.      */
  39.     private $machinePaperSizeCostMatrices;
  40.     /**
  41.      * @ORM\OneToMany(targetEntity=MachinePaperSizeTimeMatrix::class, mappedBy="machinePaperSizeMatrix",
  42.      *     cascade={"persist", "remove"})
  43.      */
  44.     private $machinePaperSizeTimeMatrices;
  45.     /**
  46.      * @ORM\Column(type="decimal", precision=10, scale=2)
  47.      */
  48.     private $rate;
  49.     /**
  50.      * @ORM\OneToMany(targetEntity=MachinePaperSizeBlackOnlyClickMatrix::class, mappedBy="machinePaperSizeMatrix",
  51.      * cascade={"persist", "remove"})
  52.      */
  53.     private $machinePaperSizeBlackOnlyClickMatrices;
  54.     /**
  55.      * @ORM\Column(type="string", length=255, options={"default" : "Colour"})
  56.      */
  57.     private $colourClickLabel;
  58.     /**
  59.      * @ORM\Column(type="string", length=255, options={"default" : "Black Only"})
  60.      */
  61.     private $blackOnlyClickLabel;
  62.     public function __construct()
  63.     {
  64.         $this->machinePaperSizeCostMatrices = new ArrayCollection();
  65.         $this->machinePaperSizeTimeMatrices = new ArrayCollection();
  66.         $this->machinePaperSizeBlackOnlyClickMatrices = new ArrayCollection();
  67.     }
  68.     public function getId(): ?int
  69.     {
  70.         return $this->id;
  71.     }
  72.     public function getSetup(): ?int
  73.     {
  74.         return $this->setup;
  75.     }
  76.     public function setSetup(int $setup): self
  77.     {
  78.         $this->setup $setup;
  79.         return $this;
  80.     }
  81.     public function getMachine(): ?Machine
  82.     {
  83.         return $this->machine;
  84.     }
  85.     public function setMachine(?Machine $machine): self
  86.     {
  87.         $this->machine $machine;
  88.         return $this;
  89.     }
  90.     public function getPaperSize(): ?PaperSize
  91.     {
  92.         return $this->paperSize;
  93.     }
  94.     public function setPaperSize(?PaperSize $paperSize): self
  95.     {
  96.         $this->paperSize $paperSize;
  97.         return $this;
  98.     }
  99.     /**
  100.      * @return Collection<int, MachinePaperSizeCostMatrix>
  101.      */
  102.     public function getMachinePaperSizeCostMatrices(): Collection
  103.     {
  104.         return $this->machinePaperSizeCostMatrices;
  105.     }
  106.     public function addMachinePaperSizeCostMatrix(MachinePaperSizeCostMatrix $machinePaperSizeCostMatrix): self
  107.     {
  108.         if (!$this->machinePaperSizeCostMatrices->contains($machinePaperSizeCostMatrix)) {
  109.             $this->machinePaperSizeCostMatrices[] = $machinePaperSizeCostMatrix;
  110.             $machinePaperSizeCostMatrix->setMachinePaperSizeMatrix($this);
  111.         }
  112.         return $this;
  113.     }
  114.     public function removeMachinePaperSizeCostMatrix(MachinePaperSizeCostMatrix $machinePaperSizeCostMatrix): self
  115.     {
  116.         if ($this->machinePaperSizeCostMatrices->removeElement($machinePaperSizeCostMatrix)) {
  117.             // set the owning side to null (unless already changed)
  118.             if ($machinePaperSizeCostMatrix->getMachinePaperSizeMatrix() === $this) {
  119.                 $machinePaperSizeCostMatrix->setMachinePaperSizeMatrix(null);
  120.             }
  121.         }
  122.         return $this;
  123.     }
  124.     /**
  125.      * @return Collection<int, MachinePaperSizeTimeMatrix>
  126.      */
  127.     public function getMachinePaperSizeTimeMatrices(): Collection
  128.     {
  129.         return $this->machinePaperSizeTimeMatrices;
  130.     }
  131.     public function addMachinePaperSizeTimeMatrix(MachinePaperSizeTimeMatrix $machinePaperSizeTimeMatrix): self
  132.     {
  133.         if (!$this->machinePaperSizeTimeMatrices->contains($machinePaperSizeTimeMatrix)) {
  134.             $this->machinePaperSizeTimeMatrices[] = $machinePaperSizeTimeMatrix;
  135.             $machinePaperSizeTimeMatrix->setMachinePaperSizeMatrix($this);
  136.         }
  137.         return $this;
  138.     }
  139.     public function removeMachinePaperSizeTimeMatrix(MachinePaperSizeTimeMatrix $machinePaperSizeTimeMatrix): self
  140.     {
  141.         if ($this->machinePaperSizeTimeMatrices->removeElement($machinePaperSizeTimeMatrix)) {
  142.             // set the owning side to null (unless already changed)
  143.             if ($machinePaperSizeTimeMatrix->getMachinePaperSizeMatrix() === $this) {
  144.                 $machinePaperSizeTimeMatrix->setMachinePaperSizeMatrix(null);
  145.             }
  146.         }
  147.         return $this;
  148.     }
  149.     public function getRate(): ?string
  150.     {
  151.         return $this->rate;
  152.     }
  153.     public function setRate(string $rate): self
  154.     {
  155.         $this->rate $rate;
  156.         return $this;
  157.     }
  158.     /**
  159.      * @return Collection<int, MachinePaperSizeBlackOnlyClickMatrix>
  160.      */
  161.     public function getMachinePaperSizeBlackOnlyClickMatrices(): Collection
  162.     {
  163.         return $this->machinePaperSizeBlackOnlyClickMatrices;
  164.     }
  165.     public function addMachinePaperSizeBlackOnlyClickMatrix(MachinePaperSizeBlackOnlyClickMatrix $machinePaperSizeBlackOnlyClickMatrix): self
  166.     {
  167.         if (!$this->machinePaperSizeBlackOnlyClickMatrices->contains($machinePaperSizeBlackOnlyClickMatrix)) {
  168.             $this->machinePaperSizeBlackOnlyClickMatrices[] = $machinePaperSizeBlackOnlyClickMatrix;
  169.             $machinePaperSizeBlackOnlyClickMatrix->setMachinePaperSizeMatrix($this);
  170.         }
  171.         return $this;
  172.     }
  173.     public function removeMachinePaperSizeBlackOnlyClickMatrix(MachinePaperSizeBlackOnlyClickMatrix $machinePaperSizeBlackOnlyClickMatrix): self
  174.     {
  175.         if ($this->machinePaperSizeBlackOnlyClickMatrices->removeElement($machinePaperSizeBlackOnlyClickMatrix)) {
  176.             // set the owning side to null (unless already changed)
  177.             if ($machinePaperSizeBlackOnlyClickMatrix->getMachinePaperSizeMatrix() === $this) {
  178.                 $machinePaperSizeBlackOnlyClickMatrix->setMachinePaperSizeMatrix(null);
  179.             }
  180.         }
  181.         return $this;
  182.     }
  183.     public function getColourClickLabel(): ?string
  184.     {
  185.         return $this->colourClickLabel;
  186.     }
  187.     public function setColourClickLabel(?string $colourClickLabel): self
  188.     {
  189.         $this->colourClickLabel $colourClickLabel;
  190.         return $this;
  191.     }
  192.     public function getBlackOnlyClickLabel(): ?string
  193.     {
  194.         return $this->blackOnlyClickLabel;
  195.     }
  196.     public function setBlackOnlyClickLabel(string $blackOnlyClickLabel): self
  197.     {
  198.         $this->blackOnlyClickLabel $blackOnlyClickLabel;
  199.         return $this;
  200.     }
  201.     public function getSideClickLabel($side 'SideOne'):string
  202.     {
  203.         if ($side === 'SideOne') {
  204.             return $this->colourClickLabel;
  205.         }else{
  206.             return $this->blackOnlyClickLabel;
  207.         }
  208.     }
  209.     public function __clone() {
  210.         $machinePaperSizeCostMatrices = new ArrayCollection();
  211.         $machinePaperSizeTimeMatrices = new ArrayCollection();
  212.         $machinePaperSizeBlackOnlyClickMatrices = new ArrayCollection();
  213.         $now = new DateTime('now');
  214.         foreach ($this->machinePaperSizeCostMatrices as $machinePaperSizeCostMatrix) {
  215.             /** @var MachinePaperSizeCostMatrix $newMachinePaperSizeCostMatrix  */
  216.             $newMachinePaperSizeCostMatrix = clone $machinePaperSizeCostMatrix;
  217.             $newMachinePaperSizeCostMatrix->setCreatedAt($now);
  218.             $newMachinePaperSizeCostMatrix->setUpdatedAt($now);
  219.             $newMachinePaperSizeCostMatrix->setMachinePaperSizeMatrix($this);
  220.             $machinePaperSizeCostMatrices->add($newMachinePaperSizeCostMatrix);
  221.         }
  222.         $this->machinePaperSizeCostMatrices $machinePaperSizeCostMatrices;
  223.         foreach ($this->machinePaperSizeTimeMatrices as $machinePaperSizeTimeMatrix) {
  224.             /** @var MachinePaperSizeTimeMatrix $newMachinePaperSizeTimeMatrix  */
  225.             $newMachinePaperSizeTimeMatrix = clone $machinePaperSizeTimeMatrix;
  226.             $newMachinePaperSizeTimeMatrix->setCreatedAt($now);
  227.             $newMachinePaperSizeTimeMatrix->setUpdatedAt($now);
  228.             $newMachinePaperSizeTimeMatrix->setMachinePaperSizeMatrix($this);
  229.             $machinePaperSizeTimeMatrices->add($newMachinePaperSizeTimeMatrix);
  230.         }
  231.         $this->machinePaperSizeTimeMatrices $machinePaperSizeTimeMatrices;
  232.         foreach ($this->machinePaperSizeBlackOnlyClickMatrices as $machinePaperSizeBlackOnlyClickMatrix) {
  233.             /** @var MachinePaperSizeBlackOnlyClickMatrix $newMachinePaperSizeBlackOnlyClickMatrix  */
  234.             $newMachinePaperSizeBlackOnlyClickMatrix = clone $machinePaperSizeBlackOnlyClickMatrix;
  235.             $newMachinePaperSizeBlackOnlyClickMatrix->setCreatedAt($now);
  236.             $newMachinePaperSizeBlackOnlyClickMatrix->setUpdatedAt($now);
  237.             $newMachinePaperSizeBlackOnlyClickMatrix->setMachinePaperSizeMatrix($this);
  238.             $machinePaperSizeBlackOnlyClickMatrices->add($newMachinePaperSizeBlackOnlyClickMatrix);
  239.         }
  240.         $this->machinePaperSizeBlackOnlyClickMatrices $machinePaperSizeBlackOnlyClickMatrices;
  241.     }
  242. }