src/Entity/ModuleTest/ModuleTest.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity\ModuleTest;
  3. use App\Entity\Comment;
  4. use App\Entity\Embeddables\DateTimeRichField;
  5. use DateTime;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use EightMarq\CoreComponent\Entity\BaseEntity;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. /**
  12.  * @ORM\Table(name="module_tests")
  13.  * @ORM\Entity(repositoryClass="App\Repository\ModuleTestRepository")
  14.  */
  15. class ModuleTest extends BaseEntity
  16. {
  17.     /**
  18.      * @var int | null
  19.      *
  20.      * @ORM\Column(type="integer")
  21.      */
  22.     protected $counter 0;
  23.     /**
  24.      * @var DateTime | null
  25.      *
  26.      * @ORM\Column(type="datetime")
  27.      *
  28.      * @Assert\NotBlank()
  29.      */
  30.     protected $testedAt;
  31.     /**
  32.      * @var Comment[] | ArrayCollection | Collection
  33.      *
  34.      * @ORM\OneToMany(targetEntity="App\Entity\Comment", mappedBy="moduleTest")
  35.      *
  36.      * @Assert\Valid()
  37.      */
  38.     protected $comments;
  39.     /**
  40.      * @var InputPhase | null
  41.      *
  42.      * @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\InputPhase", mappedBy="moduleTest", cascade={"persist"})
  43.      *
  44.      * @Assert\Valid()
  45.      */
  46.     protected $inputPhase;
  47.     /**
  48.      * @var FeasibilityCheckPhase | null
  49.      *
  50.      * @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\FeasibilityCheckPhase", mappedBy="moduleTest", cascade={"persist"})
  51.      *
  52.      * @Assert\Valid()
  53.      */
  54.     protected $feasibilityCheckPhase;
  55.     /**
  56.      * @var TestAdapterPhase | null
  57.      *
  58.      * @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\TestAdapterPhase", mappedBy="moduleTest", cascade={"persist"})
  59.      *
  60.      * @Assert\Valid()
  61.      */
  62.     protected $testAdapterPhase;
  63.     /**
  64.      * @var ModulePhase | null
  65.      *
  66.      * @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\ModulePhase", mappedBy="moduleTest", cascade={"persist"})
  67.      *
  68.      * @Assert\Valid()
  69.      */
  70.     protected $modulePhase;
  71.     /**
  72.      * @var StartUpPhase | null
  73.      *
  74.      * @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\StartUpPhase", mappedBy="moduleTest", cascade={"persist"})
  75.      *
  76.      * @Assert\Valid()
  77.      */
  78.     protected $startUpPhase;
  79.     /**
  80.      * @var DocumentationPhase | null
  81.      *
  82.      * @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\DocumentationPhase", mappedBy="moduleTest", cascade={"persist"})
  83.      *
  84.      * @Assert\Valid()
  85.      */
  86.     protected $documentationPhase;
  87.     /**
  88.      * @var ProductionInformationPhase | null
  89.      *
  90.      * @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\ProductionInformationPhase", mappedBy="moduleTest", cascade={"persist"})
  91.      *
  92.      * @Assert\Valid()
  93.      */
  94.     protected $productionInformationPhase;
  95.     /**
  96.      * @var MeasurementStartUpPhase | null
  97.      *
  98.      * @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\MeasurementStartUpPhase", mappedBy="moduleTest", cascade={"persist"})
  99.      *
  100.      * @Assert\Valid()
  101.      */
  102.     protected $measurementStartUpPhase;
  103.     /**
  104.      * @var RoutingPhase | null
  105.      *
  106.      * @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\RoutingPhase", mappedBy="moduleTest", cascade={"persist"})
  107.      *
  108.      * @Assert\Valid()
  109.      */
  110.     protected $routingPhase;
  111.     /**
  112.      * @var ArrayCollection
  113.      *
  114.      * @ORM\ManyToMany(targetEntity="App\Entity\ModuleTest\Attachment", mappedBy="moduleTests", orphanRemoval=true, cascade={"persist"})
  115.      */
  116.     protected $attachments;
  117.     /**
  118.      * Unmapped property to allow multiple file upload
  119.      *
  120.      * @var array
  121.      */
  122.     protected $attachmentFiles = [];
  123.     public function __toString()
  124.     {
  125.         return $this->inputPhase && $this->inputPhase->getType() ? $this->inputPhase->getType() : '';
  126.     }
  127.     public function __construct()
  128.     {
  129.         $this->comments = new ArrayCollection();
  130.         $this->attachments = new ArrayCollection();
  131.     }
  132.     public function initalize(): void
  133.     {
  134.         $this->setInputPhase(new InputPhase());
  135.         $this->setFeasibilityCheckPhase(new FeasibilityCheckPhase());
  136.         $this->setTestAdapterPhase(new TestAdapterPhase());
  137.             $this->getTestAdapterPhase()->setThousandA(new DateTimeRichField(''));
  138.             $this->getTestAdapterPhase()->setHv2(new DateTimeRichField(''));
  139.             $this->getTestAdapterPhase()->setDyn(new DateTimeRichField(''));
  140.             $this->getTestAdapterPhase()->setHotHv(new DateTimeRichField(''));
  141.             $this->getTestAdapterPhase()->setIso(new DateTimeRichField(''));
  142.             $this->getTestAdapterPhase()->setParaFirst(new DateTimeRichField(''));
  143.             $this->getTestAdapterPhase()->setParaSecond(new DateTimeRichField(''));
  144.             $this->getTestAdapterPhase()->setPinCheck(new DateTimeRichField(''));
  145.             $this->getTestAdapterPhase()->setPushdown(new DateTimeRichField(''));
  146.         $this->setModulePhase(new ModulePhase());
  147.             $this->getModulePhase()->setModulesForStartUp(new DateTimeRichField(''));
  148.         $this->setStartUpPhase(new StartUpPhase());
  149.             $this->getStartUpPhase()->setDynParamSetUp(new DateTimeRichField(''));
  150.             $this->getStartUpPhase()->setDateOfProgId(new DateTimeRichField(''));
  151.         $this->setProductionInformationPhase(new ProductionInformationPhase());
  152.         $this->setDocumentationPhase(new DocumentationPhase());
  153.             $this->getDocumentationPhase()->setPlmTestSpecUpdate(new DateTimeRichField(''));
  154.         $this->setMeasurementStartUpPhase(new MeasurementStartUpPhase());
  155.         $this->setRoutingPhase(new RoutingPhase());
  156.     }
  157.     /**
  158.      * @return int|null
  159.      */
  160.     public function getCounter(): ?int
  161.     {
  162.         return $this->counter;
  163.     }
  164.     /**
  165.      * @param int|null $counter
  166.      */
  167.     public function setCounter(?int $counter): void
  168.     {
  169.         $this->counter $counter;
  170.     }
  171.     /**
  172.      * @return DateTime|null
  173.      */
  174.     public function getTestedAt(): ?DateTime
  175.     {
  176.         return $this->testedAt;
  177.     }
  178.     /**
  179.      * @param DateTime|null $testedAt
  180.      */
  181.     public function setTestedAt(?DateTime $testedAt): void
  182.     {
  183.         $this->testedAt $testedAt;
  184.     }
  185.     /**
  186.      * @return Comment[]|ArrayCollection|Collection
  187.      */
  188.     public function getComments(): ?Collection
  189.     {
  190.         return $this->comments;
  191.     }
  192.     /**
  193.      * @param Comment[]|ArrayCollection|Collection $comments
  194.      */
  195.     public function setComments(?Collection $comments): void
  196.     {
  197.         $this->comments $comments;
  198.     }
  199.     /**
  200.      * @return InputPhase|null
  201.      */
  202.     public function getInputPhase(): ?InputPhase
  203.     {
  204.         return $this->inputPhase;
  205.     }
  206.     /**
  207.      * @param InputPhase|null $inputPhase
  208.      */
  209.     public function setInputPhase(?InputPhase $inputPhase): void
  210.     {
  211.         $inputPhase->setModuleTest($this);
  212.         $this->inputPhase $inputPhase;
  213.     }
  214.     /**
  215.      * @return FeasibilityCheckPhase|null
  216.      */
  217.     public function getFeasibilityCheckPhase(): ?FeasibilityCheckPhase
  218.     {
  219.         return $this->feasibilityCheckPhase;
  220.     }
  221.     /**
  222.      * @param FeasibilityCheckPhase|null $feasibilityCheckPhase
  223.      */
  224.     public function setFeasibilityCheckPhase(?FeasibilityCheckPhase $feasibilityCheckPhase): void
  225.     {
  226.         $feasibilityCheckPhase->setModuleTest($this);
  227.         $this->feasibilityCheckPhase $feasibilityCheckPhase;
  228.     }
  229.     /**
  230.      * @return TestAdapterPhase|null
  231.      */
  232.     public function getTestAdapterPhase(): ?TestAdapterPhase
  233.     {
  234.         return $this->testAdapterPhase;
  235.     }
  236.     /**
  237.      * @param TestAdapterPhase|null $testAdapterPhase
  238.      */
  239.     public function setTestAdapterPhase(?TestAdapterPhase $testAdapterPhase): void
  240.     {
  241.         $testAdapterPhase->setModuleTest($this);
  242.         $this->testAdapterPhase $testAdapterPhase;
  243.     }
  244.     /**
  245.      * @return ModulePhase|null
  246.      */
  247.     public function getModulePhase(): ?ModulePhase
  248.     {
  249.         return $this->modulePhase;
  250.     }
  251.     /**
  252.      * @param ModulePhase|null $modulePhase
  253.      */
  254.     public function setModulePhase(?ModulePhase $modulePhase): void
  255.     {
  256.         $modulePhase->setModuleTest($this);
  257.         $this->modulePhase $modulePhase;
  258.     }
  259.     /**
  260.      * @return StartUpPhase|null
  261.      */
  262.     public function getStartUpPhase(): ?StartUpPhase
  263.     {
  264.         return $this->startUpPhase;
  265.     }
  266.     /**
  267.      * @param StartUpPhase|null $startUpPhase
  268.      */
  269.     public function setStartUpPhase(?StartUpPhase $startUpPhase): void
  270.     {
  271.         $startUpPhase->setModuleTest($this);
  272.         $this->startUpPhase $startUpPhase;
  273.     }
  274.     /**
  275.      * @return DocumentationPhase|null
  276.      */
  277.     public function getDocumentationPhase(): ?DocumentationPhase
  278.     {
  279.         return $this->documentationPhase;
  280.     }
  281.     /**
  282.      * @param DocumentationPhase|null $documentationPhase
  283.      */
  284.     public function setDocumentationPhase(?DocumentationPhase $documentationPhase): void
  285.     {
  286.         $documentationPhase->setModuleTest($this);
  287.         $this->documentationPhase $documentationPhase;
  288.     }
  289.     /**
  290.      * @return ProductionInformationPhase|null
  291.      */
  292.     public function getProductionInformationPhase(): ?ProductionInformationPhase
  293.     {
  294.         return $this->productionInformationPhase;
  295.     }
  296.     /**
  297.      * @param ProductionInformationPhase|null $productionInformationPhase
  298.      */
  299.     public function setProductionInformationPhase(?ProductionInformationPhase $productionInformationPhase): void
  300.     {
  301.         $productionInformationPhase->setModuleTest($this);
  302.         $this->productionInformationPhase $productionInformationPhase;
  303.     }
  304.     /**
  305.      * @return MeasurementStartUpPhase|null
  306.      */
  307.     public function getMeasurementStartUpPhase(): ?MeasurementStartUpPhase
  308.     {
  309.         return $this->measurementStartUpPhase;
  310.     }
  311.     /**
  312.      * @param MeasurementStartUpPhase|null $measurementStartUpPhase
  313.      */
  314.     public function setMeasurementStartUpPhase(?MeasurementStartUpPhase $measurementStartUpPhase): void
  315.     {
  316.         $measurementStartUpPhase->setModuleTest($this);
  317.         $this->measurementStartUpPhase $measurementStartUpPhase;
  318.     }
  319.     /**
  320.      * @return RoutingPhase|null
  321.      */
  322.     public function getRoutingPhase(): ?RoutingPhase
  323.     {
  324.         if (!$this->routingPhase) { // this is fixing a legacy pipeline issue
  325.             $this->setRoutingPhase(new RoutingPhase());
  326.         }
  327.         return $this->routingPhase;
  328.     }
  329.     /**
  330.      * @param RoutingPhase|null $routingPhase
  331.      */
  332.     public function setRoutingPhase(?RoutingPhase $routingPhase): void
  333.     {
  334.         $routingPhase->setModuleTest($this);
  335.         $this->routingPhase $routingPhase;
  336.     }
  337.     /**
  338.      * @return ArrayCollection|Collection
  339.      */
  340.     public function getAttachments(): Collection
  341.     {
  342.         return $this->attachments;
  343.     }
  344.     /**
  345.      * @param ArrayCollection|Collection $attachments
  346.      */
  347.     public function setAttachments(Collection $attachments): void
  348.     {
  349.         $this->attachments $attachments;
  350.     }
  351.     /**
  352.      * @return int
  353.      */
  354.     public function getAttachmentCount(): int
  355.     {
  356.         return $this->attachments->count();
  357.     }
  358.     /**
  359.      * @param Attachment $attachment
  360.      */
  361.     public function addAttachment(Attachment $attachment): void
  362.     {
  363.         if (!$this->attachments->contains($attachment)) {
  364.             $this->attachments->add($attachment);
  365.             $attachment->addModuleTest($this);
  366.         };
  367.     }
  368.     /**
  369.      * @param Attachment $attachment
  370.      */
  371.     public function removeAttachment(Attachment $attachment): void
  372.     {
  373.         if ($this->attachments->contains($attachment)) {
  374.             $this->attachments->removeElement($attachment);
  375.         };
  376.     }
  377.     /**
  378.      * @return array
  379.      */
  380.     public function getAttachmentFiles(): array
  381.     {
  382.         return $this->attachmentFiles;
  383.     }
  384.     /**
  385.      * @param array $attachmentFiles
  386.      */
  387.     public function setAttachmentFiles(array $attachmentFiles): void
  388.     {
  389.         $this->attachmentFiles $attachmentFiles;
  390.     }
  391. }