<?php
namespace App\Entity;
use JsonSerializable;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Point
* @package App\Entity
*
* @ORM\Entity
* @ORM\Table(name="verification_item")
*/
class VerificationItem implements JsonSerializable
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
private $type; // the category of verification
/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
private $value; // an optional value (such as passed inspection or failed inspection)
/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
private $data; // an optional data (such as a reading from a piece of equipment)
/**
* @ORM\Column(type="text", nullable=true)
*/
private $notes; // optional notes
/**
* @ORM\Column(type="datetime", nullable=false)
*/
private $dateVerified;
/**
* @ORM\Column(type="datetime", nullable=false)
*/
private $dateAdded;
/**
* @ORM\Column(type="datetime", nullable=false)
*/
private $dateModified;
/* many to one properties */
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="verificationItems", cascade={"persist"}, fetch="EXTRA_LAZY")
*/
private $verifyingUser;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\FacilityDetails", inversedBy="verificationItems", cascade={"persist"}, fetch="EXTRA_LAZY")
*/
private $facilityDetails;
// /**
// * @ORM\ManyToOne(targetEntity="App\Entity\PanelPoint", inversedBy="verificationItems", cascade={"persist"}, fetch="EXTRA_LAZY")
// */
// private $panelPoint;
public function __construct()
{
$this->dateAdded = new \DateTime();
$this->setDateModified();
}
public function __toString()
{
return (string) $this->getName();
}
public function jsonSerialize()
{
return array(
'id'=> $this->id,
'type' => $this->type,
'value' => $this->value,
'data' => $this->data,
'notes' => $this->notes,
'dateVerified' => $this->dateVerified,
'dateAdded' => $this->dateAdded,
'dateModified' => $this->dateModified,
);
}
/**
* get id
*
* @return integer
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @return string
*/
public function getType(): ?string
{
return $this->type;
}
/**
* @param string $type
* @return VerificationItem
*/
public function setType(string $type): VerificationItem
{
$this->type = $type;
return $this;
}
/**
* @return string
*/
public function getValue(): ?string
{
return $this->value;
}
/**
* @param string $value
* @return VerificationItem
*/
public function setValue(string $value): VerificationItem
{
$this->value = $value;
return $this;
}
/**
* @return string
*/
public function getData(): ?string
{
return $this->data;
}
/**
* @param string $data
* @return VerificationItem
*/
public function setData(string $data): VerificationItem
{
$this->data = $data;
return $this;
}
/**
* @return string
*/
public function getNotes(): ?string
{
return $this->notes;
}
/**
* @param string $notes
* @return VerificationItem
*/
public function setNotes(string $notes): VerificationItem
{
$this->notes = $notes;
return $this;
}
/**
* @return \DateTime
*/
public function getDateVerified(): ?\DateTime
{
return $this->dateVerified;
}
/**
* @param \DateTime|null $dateVerified
* @return VerificationItem
*/
public function setDateVerified(\DateTime $dateVerified = null): VerificationItem
{
if( is_null( $dateVerified ) ){
$this->dateVerified = new \DateTime("now");
} else {
$this->dateVerified = $dateVerified;
}
return $this;
}
/**
* @return \DateTime
*/
public function getDateAdded(): ?\DateTime
{
return $this->dateAdded;
}
/**
* @param \DateTime $dateAdded
* @return VerificationItem
*/
public function setDateAdded(\DateTime $dateAdded): VerificationItem
{
$this->dateAdded = $dateAdded;
return $this;
}
/**
* @return \DateTime
*/
public function getDateModified(): ?\DateTime
{
return $this->dateModified;
}
/**
* @param \DateTime|null $dateModified
* @return VerificationItem
*/
public function setDateModified(\DateTime $dateModified = null): VerificationItem
{
if( is_null( $dateModified ) ){
$this->dateModified = new \DateTime("now");
} else {
$this->dateModified = $dateModified;
}
return $this;
}
/* one to one methods */
/* many to one methods */
/**
* get verifyingUser
*
* @return User
*/
public function getVerifyingUser()
{
return $this->verifyingUser;
}
/**
* set verifyingUser
*
* @param User $verifyingUser
*
* @return VerificationItem
*/
public function setVerifyingUser(User $verifyingUser): VerificationItem
{
$this->verifyingUser = $verifyingUser;
$verifyingUser->addVerificationItem( $this );
return $this;
}
/**
* get facilityDetails
*
* @return FacilityDetails
*/
public function getFacilityDetails()
{
return $this->facilityDetails;
}
/**
* set facilityDetails
*
* @param FacilityDetails $facilityDetails
*
* @return VerificationItem
*/
public function setFacilityDetails(FacilityDetails $facilityDetails): VerificationItem
{
$this->facilityDetails = $facilityDetails;
$facilityDetails->addVerificationItem( $this );
return $this;
}
/**
* get panelPoint
*
* @return PanelPoint
*/
public function getPanelPoint()
{
return $this->panelPoint;
}
/**
* set panelPoint
*
* @param PanelPoint $panelPoint
*
* @return VerificationItem
*/
public function setPanelPoint(PanelPoint $panelPoint): VerificationItem
{
$this->panelPoint = $panelPoint;
$panelPoint->addVerificationItem( $this );
return $this;
}
}