src/Entity/VerificationItem.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use JsonSerializable;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * Class Point
  9. * @package App\Entity
  10. *
  11. * @ORM\Entity
  12. * @ORM\Table(name="verification_item")
  13. */
  14. class VerificationItem implements JsonSerializable
  15. {
  16.     /**
  17.      * @ORM\Id()
  18.      * @ORM\GeneratedValue()
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=64, nullable=true)
  24.      */
  25.     private $type// the category of verification
  26.     /**
  27.      * @ORM\Column(type="string", length=64, nullable=true)
  28.      */
  29.     private $value// an optional value (such as passed inspection or failed inspection)
  30.     /**
  31.      * @ORM\Column(type="string", length=64, nullable=true)
  32.      */
  33.     private $data// an optional data (such as a reading from a piece of equipment)
  34.     /**
  35.      * @ORM\Column(type="text", nullable=true)
  36.      */
  37.     private $notes// optional notes
  38.     /**
  39.      * @ORM\Column(type="datetime", nullable=false)
  40.      */
  41.     private $dateVerified;
  42.     /**
  43.      * @ORM\Column(type="datetime", nullable=false)
  44.      */
  45.     private $dateAdded;
  46.     /**
  47.      * @ORM\Column(type="datetime", nullable=false)
  48.      */
  49.     private $dateModified;
  50.     /*  many to one properties */
  51.     /**
  52.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="verificationItems", cascade={"persist"}, fetch="EXTRA_LAZY")
  53.      */
  54.     private $verifyingUser;
  55.     /**
  56.      * @ORM\ManyToOne(targetEntity="App\Entity\FacilityDetails", inversedBy="verificationItems", cascade={"persist"}, fetch="EXTRA_LAZY")
  57.      */
  58.     private $facilityDetails;
  59. //    /**
  60. //     * @ORM\ManyToOne(targetEntity="App\Entity\PanelPoint", inversedBy="verificationItems", cascade={"persist"}, fetch="EXTRA_LAZY")
  61. //     */
  62. //    private $panelPoint;
  63.     public function __construct()
  64.     {
  65.         $this->dateAdded = new \DateTime();
  66.         $this->setDateModified();
  67.     }
  68.     public function __toString()
  69.     {
  70.         return (string) $this->getName();
  71.     }
  72.     public function jsonSerialize()
  73.     {
  74.         return array(
  75.             'id'=> $this->id,
  76.             'type' => $this->type,
  77.             'value' => $this->value,
  78.             'data' => $this->data,
  79.             'notes' => $this->notes,
  80.             'dateVerified' => $this->dateVerified,
  81.             'dateAdded' => $this->dateAdded,
  82.             'dateModified' => $this->dateModified,
  83.         );
  84.     }
  85.     /**
  86.      * get id
  87.      *
  88.      * @return integer
  89.      */
  90.     public function getId(): ?int
  91.     {
  92.         return $this->id;
  93.     }
  94.     /**
  95.      * @return string
  96.      */
  97.     public function getType(): ?string
  98.     {
  99.         return $this->type;
  100.     }
  101.     /**
  102.      * @param string $type
  103.      * @return VerificationItem
  104.      */
  105.     public function setType(string $type): VerificationItem
  106.     {
  107.         $this->type $type;
  108.         return $this;
  109.     }
  110.     /**
  111.      * @return string
  112.      */
  113.     public function getValue(): ?string
  114.     {
  115.         return $this->value;
  116.     }
  117.     /**
  118.      * @param string $value
  119.      * @return VerificationItem
  120.      */
  121.     public function setValue(string $value): VerificationItem
  122.     {
  123.         $this->value $value;
  124.         return $this;
  125.     }
  126.     /**
  127.      * @return string
  128.      */
  129.     public function getData(): ?string
  130.     {
  131.         return $this->data;
  132.     }
  133.     /**
  134.      * @param string $data
  135.      * @return VerificationItem
  136.      */
  137.     public function setData(string $data): VerificationItem
  138.     {
  139.         $this->data $data;
  140.         return $this;
  141.     }
  142.     
  143.     /**
  144.      * @return string
  145.      */
  146.     public function getNotes(): ?string
  147.     {
  148.         return $this->notes;
  149.     }
  150.     /**
  151.      * @param string $notes
  152.      * @return VerificationItem
  153.      */
  154.     public function setNotes(string $notes): VerificationItem
  155.     {
  156.         $this->notes $notes;
  157.         return $this;
  158.     }
  159.     /**
  160.      * @return \DateTime
  161.      */
  162.     public function getDateVerified(): ?\DateTime
  163.     {
  164.         return $this->dateVerified;
  165.     }
  166.     /**
  167.      * @param \DateTime|null $dateVerified
  168.      * @return VerificationItem
  169.      */
  170.     public function setDateVerified(\DateTime $dateVerified null): VerificationItem
  171.     {
  172.         if( is_null$dateVerified ) ){
  173.             $this->dateVerified = new \DateTime("now");
  174.         } else {
  175.             $this->dateVerified $dateVerified;
  176.         }
  177.         return $this;
  178.     }
  179.     /**
  180.      * @return \DateTime
  181.      */
  182.     public function getDateAdded(): ?\DateTime
  183.     {
  184.         return $this->dateAdded;
  185.     }
  186.     /**
  187.      * @param \DateTime $dateAdded
  188.      * @return VerificationItem
  189.      */
  190.     public function setDateAdded(\DateTime $dateAdded): VerificationItem
  191.     {
  192.         $this->dateAdded $dateAdded;
  193.         return $this;
  194.     }
  195.     /**
  196.      * @return \DateTime
  197.      */
  198.     public function getDateModified(): ?\DateTime
  199.     {
  200.         return $this->dateModified;
  201.     }
  202.     /**
  203.      * @param \DateTime|null $dateModified
  204.      * @return VerificationItem
  205.      */
  206.     public function setDateModified(\DateTime $dateModified null): VerificationItem
  207.     {
  208.         if( is_null$dateModified ) ){
  209.             $this->dateModified = new \DateTime("now");
  210.         } else {
  211.             $this->dateModified $dateModified;
  212.         }
  213.         return $this;
  214.     }
  215.     /*  one to one methods */
  216.     /*  many to one methods */
  217.     /**
  218.      * get verifyingUser
  219.      *
  220.      * @return User
  221.      */
  222.     public function getVerifyingUser()
  223.     {
  224.         return $this->verifyingUser;
  225.     }
  226.     /**
  227.      * set verifyingUser
  228.      *
  229.      * @param User $verifyingUser
  230.      *
  231.      * @return VerificationItem
  232.      */
  233.     public function setVerifyingUser(User $verifyingUser): VerificationItem
  234.     {
  235.         $this->verifyingUser $verifyingUser;
  236.         $verifyingUser->addVerificationItem$this );
  237.         return $this;
  238.     }
  239.     
  240.     /**
  241.      * get facilityDetails
  242.      *
  243.      * @return FacilityDetails
  244.      */
  245.     public function getFacilityDetails()
  246.     {
  247.         return $this->facilityDetails;
  248.     }
  249.     /**
  250.      * set facilityDetails
  251.      *
  252.      * @param FacilityDetails $facilityDetails
  253.      *
  254.      * @return VerificationItem
  255.      */
  256.     public function setFacilityDetails(FacilityDetails $facilityDetails): VerificationItem
  257.     {
  258.         $this->facilityDetails $facilityDetails;
  259.         $facilityDetails->addVerificationItem$this );
  260.         return $this;
  261.     }
  262.     /**
  263.      * get panelPoint
  264.      *
  265.      * @return PanelPoint
  266.      */
  267.     public function getPanelPoint()
  268.     {
  269.         return $this->panelPoint;
  270.     }
  271.     /**
  272.      * set panelPoint
  273.      *
  274.      * @param PanelPoint $panelPoint
  275.      *
  276.      * @return VerificationItem
  277.      */
  278.     public function setPanelPoint(PanelPoint $panelPoint): VerificationItem
  279.     {
  280.         $this->panelPoint $panelPoint;
  281.         $panelPoint->addVerificationItem$this );
  282.         return $this;
  283.     }
  284. }