<?php
namespace App\Entity\ModuleTest;
use App\Entity\Comment;
use App\Entity\Embeddables\DateTimeRichField;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use EightMarq\CoreComponent\Entity\BaseEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Table(name="module_tests")
* @ORM\Entity(repositoryClass="App\Repository\ModuleTestRepository")
*/
class ModuleTest extends BaseEntity
{
/**
* @var int | null
*
* @ORM\Column(type="integer")
*/
protected $counter = 0;
/**
* @var DateTime | null
*
* @ORM\Column(type="datetime")
*
* @Assert\NotBlank()
*/
protected $testedAt;
/**
* @var Comment[] | ArrayCollection | Collection
*
* @ORM\OneToMany(targetEntity="App\Entity\Comment", mappedBy="moduleTest")
*
* @Assert\Valid()
*/
protected $comments;
/**
* @var InputPhase | null
*
* @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\InputPhase", mappedBy="moduleTest", cascade={"persist"})
*
* @Assert\Valid()
*/
protected $inputPhase;
/**
* @var FeasibilityCheckPhase | null
*
* @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\FeasibilityCheckPhase", mappedBy="moduleTest", cascade={"persist"})
*
* @Assert\Valid()
*/
protected $feasibilityCheckPhase;
/**
* @var TestAdapterPhase | null
*
* @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\TestAdapterPhase", mappedBy="moduleTest", cascade={"persist"})
*
* @Assert\Valid()
*/
protected $testAdapterPhase;
/**
* @var ModulePhase | null
*
* @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\ModulePhase", mappedBy="moduleTest", cascade={"persist"})
*
* @Assert\Valid()
*/
protected $modulePhase;
/**
* @var StartUpPhase | null
*
* @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\StartUpPhase", mappedBy="moduleTest", cascade={"persist"})
*
* @Assert\Valid()
*/
protected $startUpPhase;
/**
* @var DocumentationPhase | null
*
* @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\DocumentationPhase", mappedBy="moduleTest", cascade={"persist"})
*
* @Assert\Valid()
*/
protected $documentationPhase;
/**
* @var ProductionInformationPhase | null
*
* @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\ProductionInformationPhase", mappedBy="moduleTest", cascade={"persist"})
*
* @Assert\Valid()
*/
protected $productionInformationPhase;
/**
* @var MeasurementStartUpPhase | null
*
* @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\MeasurementStartUpPhase", mappedBy="moduleTest", cascade={"persist"})
*
* @Assert\Valid()
*/
protected $measurementStartUpPhase;
/**
* @var RoutingPhase | null
*
* @ORM\OneToOne(targetEntity="App\Entity\ModuleTest\RoutingPhase", mappedBy="moduleTest", cascade={"persist"})
*
* @Assert\Valid()
*/
protected $routingPhase;
/**
* @var ArrayCollection
*
* @ORM\ManyToMany(targetEntity="App\Entity\ModuleTest\Attachment", mappedBy="moduleTests", orphanRemoval=true, cascade={"persist"})
*/
protected $attachments;
/**
* Unmapped property to allow multiple file upload
*
* @var array
*/
protected $attachmentFiles = [];
public function __toString()
{
return $this->inputPhase && $this->inputPhase->getType() ? $this->inputPhase->getType() : '';
}
public function __construct()
{
$this->comments = new ArrayCollection();
$this->attachments = new ArrayCollection();
}
public function initalize(): void
{
$this->setInputPhase(new InputPhase());
$this->setFeasibilityCheckPhase(new FeasibilityCheckPhase());
$this->setTestAdapterPhase(new TestAdapterPhase());
$this->getTestAdapterPhase()->setThousandA(new DateTimeRichField(''));
$this->getTestAdapterPhase()->setHv2(new DateTimeRichField(''));
$this->getTestAdapterPhase()->setDyn(new DateTimeRichField(''));
$this->getTestAdapterPhase()->setHotHv(new DateTimeRichField(''));
$this->getTestAdapterPhase()->setIso(new DateTimeRichField(''));
$this->getTestAdapterPhase()->setParaFirst(new DateTimeRichField(''));
$this->getTestAdapterPhase()->setParaSecond(new DateTimeRichField(''));
$this->getTestAdapterPhase()->setPinCheck(new DateTimeRichField(''));
$this->getTestAdapterPhase()->setPushdown(new DateTimeRichField(''));
$this->setModulePhase(new ModulePhase());
$this->getModulePhase()->setModulesForStartUp(new DateTimeRichField(''));
$this->setStartUpPhase(new StartUpPhase());
$this->getStartUpPhase()->setDynParamSetUp(new DateTimeRichField(''));
$this->getStartUpPhase()->setDateOfProgId(new DateTimeRichField(''));
$this->setProductionInformationPhase(new ProductionInformationPhase());
$this->setDocumentationPhase(new DocumentationPhase());
$this->getDocumentationPhase()->setPlmTestSpecUpdate(new DateTimeRichField(''));
$this->setMeasurementStartUpPhase(new MeasurementStartUpPhase());
$this->setRoutingPhase(new RoutingPhase());
}
/**
* @return int|null
*/
public function getCounter(): ?int
{
return $this->counter;
}
/**
* @param int|null $counter
*/
public function setCounter(?int $counter): void
{
$this->counter = $counter;
}
/**
* @return DateTime|null
*/
public function getTestedAt(): ?DateTime
{
return $this->testedAt;
}
/**
* @param DateTime|null $testedAt
*/
public function setTestedAt(?DateTime $testedAt): void
{
$this->testedAt = $testedAt;
}
/**
* @return Comment[]|ArrayCollection|Collection
*/
public function getComments(): ?Collection
{
return $this->comments;
}
/**
* @param Comment[]|ArrayCollection|Collection $comments
*/
public function setComments(?Collection $comments): void
{
$this->comments = $comments;
}
/**
* @return InputPhase|null
*/
public function getInputPhase(): ?InputPhase
{
return $this->inputPhase;
}
/**
* @param InputPhase|null $inputPhase
*/
public function setInputPhase(?InputPhase $inputPhase): void
{
$inputPhase->setModuleTest($this);
$this->inputPhase = $inputPhase;
}
/**
* @return FeasibilityCheckPhase|null
*/
public function getFeasibilityCheckPhase(): ?FeasibilityCheckPhase
{
return $this->feasibilityCheckPhase;
}
/**
* @param FeasibilityCheckPhase|null $feasibilityCheckPhase
*/
public function setFeasibilityCheckPhase(?FeasibilityCheckPhase $feasibilityCheckPhase): void
{
$feasibilityCheckPhase->setModuleTest($this);
$this->feasibilityCheckPhase = $feasibilityCheckPhase;
}
/**
* @return TestAdapterPhase|null
*/
public function getTestAdapterPhase(): ?TestAdapterPhase
{
return $this->testAdapterPhase;
}
/**
* @param TestAdapterPhase|null $testAdapterPhase
*/
public function setTestAdapterPhase(?TestAdapterPhase $testAdapterPhase): void
{
$testAdapterPhase->setModuleTest($this);
$this->testAdapterPhase = $testAdapterPhase;
}
/**
* @return ModulePhase|null
*/
public function getModulePhase(): ?ModulePhase
{
return $this->modulePhase;
}
/**
* @param ModulePhase|null $modulePhase
*/
public function setModulePhase(?ModulePhase $modulePhase): void
{
$modulePhase->setModuleTest($this);
$this->modulePhase = $modulePhase;
}
/**
* @return StartUpPhase|null
*/
public function getStartUpPhase(): ?StartUpPhase
{
return $this->startUpPhase;
}
/**
* @param StartUpPhase|null $startUpPhase
*/
public function setStartUpPhase(?StartUpPhase $startUpPhase): void
{
$startUpPhase->setModuleTest($this);
$this->startUpPhase = $startUpPhase;
}
/**
* @return DocumentationPhase|null
*/
public function getDocumentationPhase(): ?DocumentationPhase
{
return $this->documentationPhase;
}
/**
* @param DocumentationPhase|null $documentationPhase
*/
public function setDocumentationPhase(?DocumentationPhase $documentationPhase): void
{
$documentationPhase->setModuleTest($this);
$this->documentationPhase = $documentationPhase;
}
/**
* @return ProductionInformationPhase|null
*/
public function getProductionInformationPhase(): ?ProductionInformationPhase
{
return $this->productionInformationPhase;
}
/**
* @param ProductionInformationPhase|null $productionInformationPhase
*/
public function setProductionInformationPhase(?ProductionInformationPhase $productionInformationPhase): void
{
$productionInformationPhase->setModuleTest($this);
$this->productionInformationPhase = $productionInformationPhase;
}
/**
* @return MeasurementStartUpPhase|null
*/
public function getMeasurementStartUpPhase(): ?MeasurementStartUpPhase
{
return $this->measurementStartUpPhase;
}
/**
* @param MeasurementStartUpPhase|null $measurementStartUpPhase
*/
public function setMeasurementStartUpPhase(?MeasurementStartUpPhase $measurementStartUpPhase): void
{
$measurementStartUpPhase->setModuleTest($this);
$this->measurementStartUpPhase = $measurementStartUpPhase;
}
/**
* @return RoutingPhase|null
*/
public function getRoutingPhase(): ?RoutingPhase
{
if (!$this->routingPhase) { // this is fixing a legacy pipeline issue
$this->setRoutingPhase(new RoutingPhase());
}
return $this->routingPhase;
}
/**
* @param RoutingPhase|null $routingPhase
*/
public function setRoutingPhase(?RoutingPhase $routingPhase): void
{
$routingPhase->setModuleTest($this);
$this->routingPhase = $routingPhase;
}
/**
* @return ArrayCollection|Collection
*/
public function getAttachments(): Collection
{
return $this->attachments;
}
/**
* @param ArrayCollection|Collection $attachments
*/
public function setAttachments(Collection $attachments): void
{
$this->attachments = $attachments;
}
/**
* @return int
*/
public function getAttachmentCount(): int
{
return $this->attachments->count();
}
/**
* @param Attachment $attachment
*/
public function addAttachment(Attachment $attachment): void
{
if (!$this->attachments->contains($attachment)) {
$this->attachments->add($attachment);
$attachment->addModuleTest($this);
};
}
/**
* @param Attachment $attachment
*/
public function removeAttachment(Attachment $attachment): void
{
if ($this->attachments->contains($attachment)) {
$this->attachments->removeElement($attachment);
};
}
/**
* @return array
*/
public function getAttachmentFiles(): array
{
return $this->attachmentFiles;
}
/**
* @param array $attachmentFiles
*/
public function setAttachmentFiles(array $attachmentFiles): void
{
$this->attachmentFiles = $attachmentFiles;
}
}