2018-11-11 12:01:18 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Entity;
|
|
|
|
|
|
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
|
|
|
use Doctrine\Common\Collections\Collection;
|
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
|
use Gedmo\Mapping\Annotation as Gedmo;
|
|
|
|
|
use JsonSerializable;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Entity
|
|
|
|
|
* @ORM\Table(
|
|
|
|
|
* name="fault",
|
|
|
|
|
* indexes={
|
|
|
|
|
* @ORM\Index(name="F_facilityloc_idx", columns={"facility_location_id"}),
|
|
|
|
|
* @ORM\Index(name="F_errorcat_idx", columns={"error_category_id"}),
|
|
|
|
|
* @ORM\Index(name="F_errororig_idx", columns={"error_origin_id"}),
|
|
|
|
|
* @ORM\Index(name="F_soltimeinterval_idx", columns={"solution_time_interval_id"})
|
|
|
|
|
* }
|
|
|
|
|
* )
|
|
|
|
|
*/
|
|
|
|
|
class Fault implements JsonSerializable
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Id
|
|
|
|
|
* @ORM\Column(name="id", type="integer")
|
|
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY")
|
|
|
|
|
* @var int
|
|
|
|
|
*/
|
|
|
|
|
private $id;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="worksheet_number", type="string", length=30, nullable=true)
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
private $worksheetNumber;
|
|
|
|
|
|
2019-01-29 08:54:51 +01:00
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="fault_type", type="string", length=30, nullable=true, options={"default": "uzemeltetesi"})
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
private $faultType;
|
|
|
|
|
|
2018-11-11 12:01:18 +01:00
|
|
|
/**
|
|
|
|
|
* @ORM\JoinColumn(name="facility_location_id", nullable=false)
|
|
|
|
|
* @ORM\ManyToOne(targetEntity="FacilityLocation", inversedBy="faults")
|
|
|
|
|
* @var FacilityLocation
|
|
|
|
|
*/
|
|
|
|
|
private $facilityLocation;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="facility_location_description", type="text", length=65535, nullable=true)
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
private $facilityLocationDescription;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\JoinColumn(name="error_category_id", nullable=false)
|
|
|
|
|
* @ORM\ManyToOne(targetEntity="ErrorCategory", inversedBy="faults")
|
|
|
|
|
* @var ErrorCategory
|
|
|
|
|
*/
|
|
|
|
|
private $errorCategory;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\JoinColumn(name="error_origin_id", nullable=false)
|
|
|
|
|
* @ORM\ManyToOne(targetEntity="ErrorOrigin", inversedBy="faults")
|
|
|
|
|
* @var ErrorOrigin
|
|
|
|
|
*/
|
|
|
|
|
private $errorOrigin;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="error_description", type="text", length=65535, nullable=true)
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
private $errorDescription;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\JoinColumn(name="solution_time_interval_id", nullable=false)
|
|
|
|
|
* @ORM\ManyToOne(targetEntity="SolutionTimeInterval", inversedBy="faults")
|
|
|
|
|
* @var SolutionTimeInterval
|
|
|
|
|
*/
|
|
|
|
|
private $solutionTimeInterval;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="solution_time_interval_other", type="text", length=65535, nullable=true)
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
private $solutionTimeIntervalOther;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="state", type="string", length=15, nullable=true)
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
private $state = "new";
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\OneToMany(targetEntity="Attachment", mappedBy="fault")
|
|
|
|
|
* @var Attachment[]
|
|
|
|
|
*/
|
|
|
|
|
private $attachments;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\JoinColumn(name="reporter_id", nullable=true)
|
|
|
|
|
* @ORM\ManyToOne(targetEntity="User", inversedBy="reportedFaults")
|
|
|
|
|
* @var User
|
|
|
|
|
*/
|
|
|
|
|
private $reporter;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\JoinColumn(name="worker_id", nullable=true)
|
|
|
|
|
* @ORM\ManyToOne(targetEntity="User", inversedBy="workingOnFaults")
|
|
|
|
|
* @var User
|
|
|
|
|
*/
|
|
|
|
|
private $worker;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\JoinColumn(name="confirmer_id", nullable=true)
|
|
|
|
|
* @ORM\ManyToOne(targetEntity="User", inversedBy="confirmedFaults")
|
|
|
|
|
* @var User
|
|
|
|
|
*/
|
|
|
|
|
private $confirmer;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="confirmed_at", type="datetime", nullable=true)
|
|
|
|
|
* @var \DateTime
|
|
|
|
|
*/
|
|
|
|
|
private $confirmedAt;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\JoinColumn(name="acknowledger_id", nullable=true)
|
|
|
|
|
* @ORM\ManyToOne(targetEntity="User", inversedBy="acknowledgedFaults")
|
|
|
|
|
* @var User
|
|
|
|
|
*/
|
|
|
|
|
private $acknowledgedBy;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="acknowledged_at", type="datetime", nullable=true)
|
|
|
|
|
* @var \DateTime
|
|
|
|
|
*/
|
|
|
|
|
private $acknowledgedAt;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\JoinColumn(name="approver_id", nullable=true)
|
|
|
|
|
* @ORM\ManyToOne(targetEntity="User", inversedBy="approvedFaults")
|
|
|
|
|
* @var User
|
|
|
|
|
*/
|
|
|
|
|
private $approvedBy;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="approved_at", type="datetime", nullable=true)
|
|
|
|
|
* @var \DateTime
|
|
|
|
|
*/
|
|
|
|
|
private $approvedAt;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="report_accepted", type="datetime", nullable=true)
|
|
|
|
|
* @var \DateTime
|
|
|
|
|
* @todo possibly unused
|
|
|
|
|
*/
|
|
|
|
|
private $reportAccepted;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="work_started", type="datetime", nullable=true)
|
|
|
|
|
* @var \DateTime
|
|
|
|
|
*/
|
|
|
|
|
private $workStarted;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="work_finished", type="datetime", nullable=true)
|
|
|
|
|
* @var \DateTime
|
|
|
|
|
*/
|
|
|
|
|
private $workFinished;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="time_spent", type="float", nullable=true)
|
|
|
|
|
* @var float
|
|
|
|
|
*/
|
|
|
|
|
private $timeSpent;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="work_cost_estimate", type="integer", nullable=true)
|
|
|
|
|
* @var int
|
|
|
|
|
*/
|
|
|
|
|
private $workCostEstimate;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="material_cost_estimate", type="integer", nullable=true)
|
|
|
|
|
* @var int
|
|
|
|
|
*/
|
|
|
|
|
private $materialCostEstimate;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="used_materials", type="array", length=65535, nullable=true)
|
|
|
|
|
* @var mixed
|
|
|
|
|
*/
|
|
|
|
|
private $usedMaterials;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="work_done", type="array", length=65535, nullable=true)
|
|
|
|
|
* @var mixed
|
|
|
|
|
*/
|
|
|
|
|
private $workDone;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="created_at", type="datetime", nullable=true)
|
|
|
|
|
* @Gedmo\Timestampable(on="create")
|
|
|
|
|
* @var \DateTime
|
|
|
|
|
*/
|
|
|
|
|
private $createdAt;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\OneToMany(targetEntity="FaultSnapshot", mappedBy="fault")
|
|
|
|
|
* @var FaultSnapshot[]
|
|
|
|
|
*/
|
|
|
|
|
private $snapshots;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\OneToMany(targetEntity="FaultComment", mappedBy="fault")
|
|
|
|
|
* @var FaultComment[]
|
|
|
|
|
*/
|
|
|
|
|
private $comments;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="must_lower_cost", type="boolean", options={"default": false})
|
|
|
|
|
* @var bool
|
|
|
|
|
*/
|
|
|
|
|
private $mustLowerCost = false;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ORM\Column(name="allocated_expense", type="integer", options={"default": 0})
|
|
|
|
|
* @var int
|
|
|
|
|
*/
|
|
|
|
|
private $allocatedExpense = 0;
|
|
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this->attachments = new ArrayCollection();
|
|
|
|
|
$this->snapshots = new ArrayCollection();
|
|
|
|
|
$this->comments = new ArrayCollection();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getId(): int
|
|
|
|
|
{
|
|
|
|
|
return $this->id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param int $id
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setId(int $id): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->id = $id;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getWorksheetNumber(): ?string
|
|
|
|
|
{
|
|
|
|
|
return $this->worksheetNumber;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $worksheetNumber
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setWorksheetNumber(?string $worksheetNumber): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->worksheetNumber = $worksheetNumber;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-29 08:54:51 +01:00
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getFaultType(): ?string
|
|
|
|
|
{
|
|
|
|
|
return $this->faultType;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $faultType
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setFaultType(?string $faultType): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->faultType = $faultType;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-11 12:01:18 +01:00
|
|
|
/**
|
|
|
|
|
* @return FacilityLocation
|
|
|
|
|
*/
|
|
|
|
|
public function getFacilityLocation(): FacilityLocation
|
|
|
|
|
{
|
|
|
|
|
return $this->facilityLocation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param FacilityLocation $facilityLocation
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setFacilityLocation(FacilityLocation $facilityLocation): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->facilityLocation = $facilityLocation;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getFacilityLocationDescription()
|
|
|
|
|
{
|
|
|
|
|
return $this->facilityLocationDescription;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $facilityLocationDescription
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setFacilityLocationDescription(string $facilityLocationDescription): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->facilityLocationDescription = $facilityLocationDescription;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return ErrorCategory
|
|
|
|
|
*/
|
|
|
|
|
public function getErrorCategory(): ErrorCategory
|
|
|
|
|
{
|
|
|
|
|
return $this->errorCategory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param ErrorCategory $errorCategory
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setErrorCategory(ErrorCategory $errorCategory): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->errorCategory = $errorCategory;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return ErrorOrigin
|
|
|
|
|
*/
|
|
|
|
|
public function getErrorOrigin(): ErrorOrigin
|
|
|
|
|
{
|
|
|
|
|
return $this->errorOrigin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param ErrorOrigin $errorOrigin
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setErrorOrigin(ErrorOrigin $errorOrigin): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->errorOrigin = $errorOrigin;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getErrorDescription()
|
|
|
|
|
{
|
|
|
|
|
return $this->errorDescription;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $errorDescription
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setErrorDescription(string $errorDescription): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->errorDescription = $errorDescription;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return SolutionTimeInterval
|
|
|
|
|
*/
|
|
|
|
|
public function getSolutionTimeInterval(): SolutionTimeInterval
|
|
|
|
|
{
|
|
|
|
|
return $this->solutionTimeInterval;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param SolutionTimeInterval $solutionTimeInterval
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setSolutionTimeInterval(SolutionTimeInterval $solutionTimeInterval): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->solutionTimeInterval = $solutionTimeInterval;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getSolutionTimeIntervalOther()
|
|
|
|
|
{
|
|
|
|
|
return $this->solutionTimeIntervalOther;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $solutionTimeIntervalOther
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setSolutionTimeIntervalOther(string $solutionTimeIntervalOther): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->solutionTimeIntervalOther = $solutionTimeIntervalOther;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getState(): string
|
|
|
|
|
{
|
|
|
|
|
return $this->state;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $state
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setState(string $state): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->state = $state;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return ArrayCollection
|
|
|
|
|
*/
|
|
|
|
|
public function getAttachments()
|
|
|
|
|
{
|
|
|
|
|
return $this->attachments;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param Attachment $attachment
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function addAttachment(Attachment $attachment): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->attachments->add($attachment);
|
|
|
|
|
$attachment->setFault($this);
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function addAttachments(Collection $attachments): Fault
|
|
|
|
|
{
|
|
|
|
|
foreach ($attachments as $attachment) {
|
|
|
|
|
$this->addAttachment($attachment);
|
|
|
|
|
}
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param Attachment $attachment
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function removeAttachment(Attachment $attachment): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->attachments->removeElement($attachment);
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function removeAttachments(Collection $attachments): Fault
|
|
|
|
|
{
|
|
|
|
|
foreach ($attachments as $attachment) {
|
|
|
|
|
$this->removeAttachment($attachment);
|
|
|
|
|
}
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return User
|
|
|
|
|
*/
|
|
|
|
|
public function getReporter()
|
|
|
|
|
{
|
|
|
|
|
return $this->reporter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param User $reporter
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setReporter(User $reporter)
|
|
|
|
|
{
|
|
|
|
|
$this->reporter = $reporter;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return User
|
|
|
|
|
*/
|
|
|
|
|
public function getWorker()
|
|
|
|
|
{
|
|
|
|
|
return $this->worker;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param User $worker
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setWorker($worker)
|
|
|
|
|
{
|
|
|
|
|
$this->worker = $worker;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return User
|
|
|
|
|
*/
|
|
|
|
|
public function getConfirmer(): ?User
|
|
|
|
|
{
|
|
|
|
|
return $this->confirmer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param User $confirmer
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setConfirmer(?User $confirmer): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->confirmer = $confirmer;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return \DateTime
|
|
|
|
|
*/
|
|
|
|
|
public function getConfirmedAt(): ?\DateTime
|
|
|
|
|
{
|
|
|
|
|
return $this->confirmedAt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param \DateTime $confirmedAt
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setConfirmedAt(?\DateTime $confirmedAt): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->confirmedAt = $confirmedAt;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return User
|
|
|
|
|
*/
|
|
|
|
|
public function getAcknowledgedBy(): ?User
|
|
|
|
|
{
|
|
|
|
|
return $this->acknowledgedBy;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param User $acknowledgedBy
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setAcknowledgedBy(?User $acknowledgedBy): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->acknowledgedBy = $acknowledgedBy;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return \DateTime
|
|
|
|
|
*/
|
|
|
|
|
public function getAcknowledgedAt(): ?\DateTime
|
|
|
|
|
{
|
|
|
|
|
return $this->acknowledgedAt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param \DateTime $acknowledgedAt
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setAcknowledgedAt(?\DateTime $acknowledgedAt): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->acknowledgedAt = $acknowledgedAt;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return User
|
|
|
|
|
*/
|
|
|
|
|
public function getApprovedBy(): ?User
|
|
|
|
|
{
|
|
|
|
|
return $this->approvedBy;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param User $approvedBy
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setApprovedBy(?User $approvedBy): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->approvedBy = $approvedBy;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return \DateTime
|
|
|
|
|
*/
|
|
|
|
|
public function getApprovedAt(): ?\DateTime
|
|
|
|
|
{
|
|
|
|
|
return $this->approvedAt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param \DateTime $approvedAt
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setApprovedAt(?\DateTime $approvedAt): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->approvedAt = $approvedAt;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return \DateTime
|
|
|
|
|
*/
|
|
|
|
|
public function getReportAccepted(): ?\DateTime
|
|
|
|
|
{
|
|
|
|
|
return $this->reportAccepted;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param \DateTime $reportAccepted
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setReportAccepted(?\DateTime $reportAccepted): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->reportAccepted = $reportAccepted;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return \DateTime
|
|
|
|
|
*/
|
|
|
|
|
public function getWorkStarted()
|
|
|
|
|
{
|
|
|
|
|
return $this->workStarted;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param \DateTime $workStarted
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setWorkStarted(\DateTime $workStarted): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->workStarted = $workStarted;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return \DateTime
|
|
|
|
|
*/
|
|
|
|
|
public function getWorkFinished()
|
|
|
|
|
{
|
|
|
|
|
return $this->workFinished;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param \DateTime $workFinished
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setWorkFinished(\DateTime $workFinished): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->workFinished = $workFinished;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return float
|
|
|
|
|
*/
|
|
|
|
|
public function getTimeSpent(): ?float
|
|
|
|
|
{
|
|
|
|
|
return $this->timeSpent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param float $timeSpent
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setTimeSpent(?float $timeSpent): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->timeSpent = $timeSpent;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getWorkCostEstimate(): ?int
|
|
|
|
|
{
|
|
|
|
|
return $this->workCostEstimate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param int $workCostEstimate
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setWorkCostEstimate(?int $workCostEstimate): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->workCostEstimate = $workCostEstimate;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getMaterialCostEstimate(): ?int
|
|
|
|
|
{
|
|
|
|
|
return $this->materialCostEstimate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param int $materialCostEstimate
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setMaterialCostEstimate(?int $materialCostEstimate): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->materialCostEstimate = $materialCostEstimate;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
public function getUsedMaterials()
|
|
|
|
|
{
|
|
|
|
|
return $this->usedMaterials;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param mixed $usedMaterials
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setUsedMaterials($usedMaterials)
|
|
|
|
|
{
|
|
|
|
|
$this->usedMaterials = $usedMaterials;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
|
|
|
|
public function getWorkDone()
|
|
|
|
|
{
|
|
|
|
|
return $this->workDone;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param mixed $workDone
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setWorkDone($workDone)
|
|
|
|
|
{
|
|
|
|
|
$this->workDone = $workDone;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return \DateTime
|
|
|
|
|
*/
|
|
|
|
|
public function getCreatedAt()
|
|
|
|
|
{
|
|
|
|
|
return $this->createdAt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param \DateTime $createdAt
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setCreatedAt(\DateTime $createdAt): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->createdAt = $createdAt;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return ArrayCollection
|
|
|
|
|
*/
|
|
|
|
|
public function getSnapshots()
|
|
|
|
|
{
|
|
|
|
|
return $this->snapshots;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return ArrayCollection
|
|
|
|
|
*/
|
|
|
|
|
public function getComments()
|
|
|
|
|
{
|
|
|
|
|
return $this->comments;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param FaultComment $comment
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function addComment(FaultComment $comment): Fault
|
|
|
|
|
{
|
|
|
|
|
if (!$this->comments->contains($comment)) {
|
|
|
|
|
$this->comments->add($comment);
|
|
|
|
|
$comment->setFault($this);
|
|
|
|
|
}
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function addComments(Collection $comments): Fault
|
|
|
|
|
{
|
|
|
|
|
foreach ($comments as $comment) {
|
|
|
|
|
$this->addComment($comment);
|
|
|
|
|
}
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param FaultComment $comment
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function removeComment(FaultComment $comment): Fault
|
|
|
|
|
{
|
|
|
|
|
if ($this->comments->contains($comment)) {
|
|
|
|
|
$this->comments->removeElement($comment);
|
|
|
|
|
}
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function removeComments(Collection $comments): Fault
|
|
|
|
|
{
|
|
|
|
|
foreach ($comments as $comment) {
|
|
|
|
|
$this->removeComment($comment);
|
|
|
|
|
}
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function isMustLowerCost(): ?bool
|
|
|
|
|
{
|
|
|
|
|
return $this->mustLowerCost;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param bool $mustLowerCost
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setMustLowerCost(?bool $mustLowerCost): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->mustLowerCost = $mustLowerCost;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getAllocatedExpense(): ?int
|
|
|
|
|
{
|
|
|
|
|
return $this->allocatedExpense;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param int $allocatedExpense
|
|
|
|
|
* @return Fault
|
|
|
|
|
*/
|
|
|
|
|
public function setAllocatedExpense(?int $allocatedExpense): Fault
|
|
|
|
|
{
|
|
|
|
|
$this->allocatedExpense = $allocatedExpense;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function jsonSerialize()
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'id' => $this->id,
|
2019-01-29 08:54:51 +01:00
|
|
|
'faultType' => $this->getFaultType(),
|
2018-11-11 12:01:18 +01:00
|
|
|
'facilityLocation' => $this->getFacilityLocation(),
|
|
|
|
|
'facilityLocationDescription' => $this->getFacilityLocationDescription(),
|
|
|
|
|
'errorCategory' => $this->getErrorCategory(),
|
|
|
|
|
'errorOrigin' => $this->getErrorOrigin(),
|
|
|
|
|
'errorDescription' => $this->getErrorDescription(),
|
|
|
|
|
'solutionTimeInterval' => $this->getSolutionTimeInterval(),
|
|
|
|
|
'solutionTimeIntervalOther' => $this->getSolutionTimeIntervalOther(),
|
|
|
|
|
'state' => $this->getState(),
|
|
|
|
|
'attachments' => $this->getAttachments()->getValues() ?? [],
|
|
|
|
|
'worker' => $this->getWorker(),
|
|
|
|
|
'confirmer' => $this->getConfirmer(),
|
|
|
|
|
'confirmedAt' => $this->getConfirmedAt(),
|
|
|
|
|
'acknowledgedBy' => $this->getAcknowledgedBy(),
|
|
|
|
|
'acknowledgedAt' => $this->getAcknowledgedAt(),
|
|
|
|
|
'approvedBy' => $this->getApprovedBy(),
|
|
|
|
|
'approvedAt' => $this->getApprovedAt(),
|
|
|
|
|
'reportAccepted' => $this->getReportAccepted(),
|
|
|
|
|
'workStarted' => $this->getWorkStarted(),
|
|
|
|
|
'workFinished' => $this->getWorkFinished(),
|
|
|
|
|
'worksheetNumber' => $this->getWorksheetNumber(),
|
|
|
|
|
'timeSpent' => $this->getTimeSpent(),
|
|
|
|
|
'workCostEstimate' => $this->getWorkCostEstimate(),
|
|
|
|
|
'materialCostEstimate' => $this->getMaterialCostEstimate(),
|
|
|
|
|
'usedMaterials' => $this->getUsedMaterials() ?? [],
|
|
|
|
|
'workDone' => $this->getWorkDone() ?? [],
|
|
|
|
|
'createdAt' => $this->getCreatedAt(),
|
|
|
|
|
'faultSnapshots' => $this->getSnapshots()->toArray() ?? [],
|
|
|
|
|
'comments' => $this->getComments()->toArray() ?? [],
|
|
|
|
|
'mustLowerCost' => $this->isMustLowerCost(),
|
|
|
|
|
'allocatedExpense' => $this->getAllocatedExpense(),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getFlatValues()
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'id' => $this->id,
|
2019-01-29 08:54:51 +01:00
|
|
|
'faultType' => $this->getFaultType(),
|
2018-11-11 12:01:18 +01:00
|
|
|
'facilityLocation' => $this->getFacilityLocation()->getId(),
|
|
|
|
|
'facilityLocationDescription' => $this->getFacilityLocationDescription(),
|
|
|
|
|
'errorCategory' => $this->getErrorCategory()->getId(),
|
|
|
|
|
'errorOrigin' => $this->getErrorOrigin()->getId(),
|
|
|
|
|
'errorDescription' => $this->getErrorDescription(),
|
|
|
|
|
'solutionTimeInterval' => $this->getSolutionTimeInterval()->getId(),
|
|
|
|
|
'solutionTimeIntervalOther' => $this->getSolutionTimeIntervalOther(),
|
|
|
|
|
'state' => $this->getState(),
|
|
|
|
|
'attachments' => $this->getAttachments()->getValues() ?? [],
|
|
|
|
|
'worker' => $this->getWorker() ? $this->getWorker()->getId() : null,
|
|
|
|
|
'confirmer' => $this->getConfirmer() ? $this->getConfirmer()->getId() : null,
|
|
|
|
|
'confirmedAt' => $this->getConfirmedAt(),
|
|
|
|
|
'acknowledgedBy' => $this->getAcknowledgedBy() ? $this->getAcknowledgedBy()->getId() : null,
|
|
|
|
|
'acknowledgedAt' => $this->getAcknowledgedAt(),
|
|
|
|
|
'approvedBy' => $this->getApprovedBy() ? $this->getApprovedBy()->getId() : null,
|
|
|
|
|
'approvedAt' => $this->getApprovedAt(),
|
|
|
|
|
'reportAccepted' => $this->getReportAccepted(),
|
|
|
|
|
'workStarted' => $this->getWorkStarted(),
|
|
|
|
|
'workFinished' => $this->getWorkFinished(),
|
|
|
|
|
'worksheetNumber' => $this->getWorksheetNumber(),
|
|
|
|
|
'timeSpent' => $this->getTimeSpent(),
|
|
|
|
|
'workCostEstimate' => $this->getWorkCostEstimate(),
|
|
|
|
|
'materialCostEstimate' => $this->getMaterialCostEstimate(),
|
|
|
|
|
'usedMaterials' => $this->getUsedMaterials() ?? [],
|
|
|
|
|
'workDone' => $this->getWorkDone() ?? [],
|
|
|
|
|
'createdAt' => $this->getCreatedAt(),
|
|
|
|
|
'faultSnapshots' => $this->getSnapshots()->toArray() ?? [],
|
|
|
|
|
'comments' => $this->getComments()->toArray() ?? [],
|
|
|
|
|
'mustLowerCost' => $this->isMustLowerCost(),
|
|
|
|
|
'allocatedExpense' => $this->getAllocatedExpense(),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|