src/Entity/FacilityWorkstation.php line 120

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use JsonSerializable;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9. * @ApiResource()
  10. * Class FacilityWorkstation
  11. * @package App\Entity
  12. *
  13. * @ORM\Entity
  14. * @ORM\Table(name="facility_workstation")
  15. */
  16. class FacilityWorkstation implements JsonSerializable
  17. {
  18.     /**
  19.      * @ORM\Id()
  20.      * @ORM\GeneratedValue()
  21.      * @ORM\Column(type="integer")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @ORM\Column(type="string", length=128, nullable=true)
  26.      */
  27.     private $computerName;
  28.     /**
  29.      * @ORM\Column(type="string", length=128, nullable=true)
  30.      */
  31.     private $computerIpAddress;
  32.     /**
  33.      * @ORM\Column(type="string", length=128, nullable=true)
  34.      */
  35.     private $computerLocation;
  36.     /**
  37.      * @ORM\Column(type="string", length=128, nullable=true)
  38.      */
  39.     private $computerRole// workstation || server
  40.     /**
  41.      * @ORM\Column(type="integer", length=2, nullable=true)
  42.      */
  43.     private $numberOfDisplays;
  44.     /**
  45.      * @ORM\Column(type="string", length=16, nullable=true)
  46.      */
  47.     private $displayResolution1;
  48.     /**
  49.      * @ORM\Column(type="string", length=16, nullable=true)
  50.      */
  51.     private $displayResolution2;
  52.     /**
  53.      * @ORM\Column(type="string", length=16, nullable=true)
  54.      */
  55.     private $displayResolution3;
  56.     /**
  57.      * @ORM\Column(type="string", length=16, nullable=true)
  58.      */
  59.     private $displayResolution4;
  60.     /**
  61.      * @ORM\Column(type="boolean", nullable=true)
  62.      */
  63.     private $isActive true;
  64.     /**
  65.      * @ORM\Column(type="text", nullable=true)
  66.      */
  67.     private $notes// text
  68.     /**
  69.      * @ORM\Column(type="datetime", nullable=false)
  70.      */
  71.     private $dateAdded;
  72.     /**
  73.      * @ORM\Column(type="datetime", nullable=false)
  74.      */
  75.     private $dateModified;
  76.     /*  many to one properties */
  77.     /**
  78.      * @ORM\ManyToOne(targetEntity="App\Entity\FacilityDetails", inversedBy="facilityWorkstations", cascade={"persist"}, fetch="EXTRA_LAZY")
  79.      */
  80.     private $facilityDetails;
  81.     /**
  82.      * @ORM\ManyToOne(targetEntity="App\Entity\Facility", inversedBy="facilityWorkstations", cascade={"persist"}, fetch="EXTRA_LAZY")
  83.      */
  84.     private $facility;
  85.     public function __construct()
  86.     {
  87.         $this->dateAdded = new \DateTime();
  88.         $this->setDateModified();
  89.     }
  90.     public function __toString()
  91.     {
  92.         return (string) $this->getComputerName();
  93.     }
  94.     public function jsonSerialize()
  95.     {
  96.         return array(
  97.             'id'=> $this->id,
  98.             'computerName' => $this->computerName,
  99.             'computerIpAddress' => $this->computerIpAddress,
  100.             'computerLocation' => $this->computerLocation,
  101.             'computerRole' => $this->computerRole,
  102.             'numberOfDisplays' => $this->numberOfDisplays,
  103.             'displayResolution1' => $this->displayResolution1,
  104.             'displayResolution2' => $this->displayResolution2,
  105.             'displayResolution3' => $this->displayResolution3,
  106.             'displayResolution4' => $this->displayResolution4,
  107.             'dateAdded' => $this->dateAdded,
  108.             'dateModified' => $this->dateModified,
  109.             'facilityDetailsId' => ( !is_null$this->facilityDetails ) ) ? $this->facilityDetails->getId() : null,
  110.             'DT_RowId' => "row_" $this->id,
  111.         );
  112.     }
  113.     /**
  114.      * get id
  115.      *
  116.      * @return integer
  117.      */
  118.     public function getId(): ?int
  119.     {
  120.         return $this->id;
  121.     }
  122.     /**
  123.      * set id
  124.      *
  125.      * @param integer $id
  126.      * @return FacilityWorkstation
  127.      */
  128.     public function setId($id): FacilityWorkstation
  129.     {
  130.         $this->id $id;
  131.         return $this;
  132.     }
  133.     /**
  134.      * @return string
  135.      */
  136.     public function getComputerName(): ?string
  137.     {
  138.         return $this->computerName;
  139.     }
  140.     /**
  141.      * @param string $computerName
  142.      * @return FacilityWorkstation
  143.      */
  144.     public function setComputerNamestring $computerName): FacilityWorkstation
  145.     {
  146.         $this->computerName $computerName;
  147.         return $this;
  148.     }
  149.     /**
  150.      * @return string
  151.      */
  152.     public function getComputerIpAddress(): ?string
  153.     {
  154.         return $this->computerIpAddress;
  155.     }
  156.     /**
  157.      * @param string $computerIpAddress
  158.      * @return FacilityWorkstation
  159.      */
  160.     public function setComputerIpAddress($computerIpAddress): FacilityWorkstation
  161.     {
  162.         $this->computerIpAddress $computerIpAddress;
  163.         return $this;
  164.     }
  165.     /**
  166.      * @return string
  167.      */
  168.     public function getComputerLocation(): ?string
  169.     {
  170.         return $this->computerLocation;
  171.     }
  172.     /**
  173.      * @param string $computerLocation
  174.      * @return FacilityWorkstation
  175.      */
  176.     public function setComputerLocation(string $computerLocation): FacilityWorkstation
  177.     {
  178.         $this->computerLocation $computerLocation;
  179.         return $this;
  180.     }
  181.     /**
  182.      * @return string
  183.      */
  184.     public function getComputerRole(): ?string
  185.     {
  186.         return $this->computerRole;
  187.     }
  188.     /**
  189.      * @param string $computerRole
  190.      * @return FacilityWorkstation
  191.      */
  192.     public function setComputerRole(string $computerRole): FacilityWorkstation
  193.     {
  194.         $this->computerRole $computerRole;
  195.         return $this;
  196.     }
  197.     /**
  198.      * @return integer
  199.      */
  200.     public function getNumberOfDisplays(): ?int
  201.     {
  202.         return $this->numberOfDisplays;
  203.     }
  204.     /**
  205.      * @param integer $numberOfDisplays
  206.      * @return FacilityWorkstation
  207.      */
  208.     public function setNumberOfDisplays(int $numberOfDisplays): FacilityWorkstation
  209.     {
  210.         $this->numberOfDisplays $numberOfDisplays;
  211.         return $this;
  212.     }
  213.     /**
  214.      * @return string
  215.      */
  216.     public function getDisplayResolution1(): ?string
  217.     {
  218.         return $this->displayResolution1;
  219.     }
  220.     /**
  221.      * @param string $displayResolution1
  222.      * @return FacilityWorkstation
  223.      */
  224.     public function setDisplayResolution1(string $displayResolution1): FacilityWorkstation
  225.     {
  226.         $this->displayResolution1 $displayResolution1;
  227.         return $this;
  228.     }
  229.     /**
  230.      * @return string
  231.      */
  232.     public function getDisplayResolution2(): ?string
  233.     {
  234.         return $this->displayResolution2;
  235.     }
  236.     /**
  237.      * @param string $displayResolution2
  238.      * @return FacilityWorkstation
  239.      */
  240.     public function setDisplayResolution2(string $displayResolution2): FacilityWorkstation
  241.     {
  242.         $this->displayResolution2 $displayResolution2;
  243.         return $this;
  244.     }
  245.     /**
  246.      * @return string
  247.      */
  248.     public function getDisplayResolution3(): ?string
  249.     {
  250.         return $this->displayResolution3;
  251.     }
  252.     /**
  253.      * @param string $displayResolution3
  254.      * @return FacilityWorkstation
  255.      */
  256.     public function setDisplayResolution3(string $displayResolution3): FacilityWorkstation
  257.     {
  258.         $this->displayResolution3 $displayResolution3;
  259.         return $this;
  260.     }
  261.     /**
  262.      * @return string
  263.      */
  264.     public function getDisplayResolution4(): ?string
  265.     {
  266.         return $this->displayResolution4;
  267.     }
  268.     /**
  269.      * @param string $displayResolution4
  270.      * @return FacilityWorkstation
  271.      */
  272.     public function setDisplayResolution4(string $displayResolution4): FacilityWorkstation
  273.     {
  274.         $this->displayResolution4 $displayResolution4;
  275.         return $this;
  276.     }
  277.     /**
  278.      * @return boolean
  279.      */
  280.     public function getIsActive()
  281.     {
  282.         return $this->isActive;
  283.     }
  284.     /**
  285.      * @param boolean $isActive
  286.      * @return FacilityWorkstation
  287.      */
  288.     public function setIsActive($isActive)
  289.     {
  290.         $this->isActive $isActive;
  291.         return $this;
  292.     }
  293.     /**
  294.      * @return string
  295.      */
  296.     public function getNotes(): ?string
  297.     {
  298.         return $this->notes;
  299.     }
  300.     /**
  301.      * @param string|null $notes
  302.      * @return FacilityWorkstation
  303.      */
  304.     public function setNotes(string $notes null): FacilityDetails
  305.     {
  306.         $this->notes $notes;
  307.         return $this;
  308.     }
  309.     
  310.     /**
  311.      * @return \DateTime
  312.      */
  313.     public function getDateAdded(): ?\DateTime
  314.     {
  315.         return $this->dateAdded;
  316.     }
  317.     /**
  318.      * @param \DateTime $dateAdded
  319.      * @return FacilityWorkstation
  320.      */
  321.     public function setDateAdded(\DateTime $dateAdded): FacilityWorkstation
  322.     {
  323.         $this->dateAdded $dateAdded;
  324.         return $this;
  325.     }
  326.     /**
  327.      * @return \DateTime
  328.      */
  329.     public function getDateModified(): ?\DateTime
  330.     {
  331.         return $this->dateModified;
  332.     }
  333.     /**
  334.      * @param \DateTime|null $dateModified
  335.      * @return FacilityWorkstation
  336.      */
  337.     public function setDateModified(\DateTime $dateModified null): FacilityWorkstation
  338.     {
  339.         if( is_null$dateModified ) ){
  340.             $this->dateModified = new \DateTime("now");
  341.         } else {
  342.             $this->dateModified $dateModified;
  343.         }
  344.         return $this;
  345.     }
  346.     /*  many to one methods */
  347.     /**
  348.      * get facilityDetails
  349.      *
  350.      * @return FacilityDetails
  351.      */
  352.     public function getFacilityDetails(): ?FacilityDetails
  353.     {
  354.         return $this->facilityDetails;
  355.     }
  356.     /**
  357.      * set facilityDetails
  358.      *
  359.      * @param FacilityDetails $facilityDetails
  360.      *
  361.      * @return FacilityWorkstation
  362.      */
  363.     public function setFacilityDetails(FacilityDetails $facilityDetails): FacilityWorkstation
  364.     {
  365.         $this->facilityDetails $facilityDetails;
  366.         $facilityDetails->addFacilityWorkstation$this );
  367.         return $this;
  368.     }
  369.     /**
  370.      * get facility
  371.      *
  372.      * @return Facility
  373.      */
  374.     public function getFacility(): ?Facility
  375.     {
  376.         return $this->facility;
  377.     }
  378.     /**
  379.      * set facility
  380.      *
  381.      * @param Facility $facility
  382.      *
  383.      * @return FacilityWorkstation
  384.      */
  385.     public function setFacility(Facility $facility null): FacilityWorkstation
  386.     {
  387.         $this->facility $facility;
  388.         if( !is_null$facility ) ){
  389.             $facility->addFacilityWorkstation$this );
  390.         } else {
  391.             $facility->removeFacilityWorkstation$this );
  392.         }
  393.         return $this;
  394.     }
  395. }