src/Entity/WorkExperience.php line 203

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * @ORM\Entity(repositoryClass="App\Repository\WorkExperienceRepository")
  6.  */
  7. class WorkExperience implements \JsonSerializable
  8. {
  9.     /**
  10.      * @ORM\Id()
  11.      * @ORM\GeneratedValue()
  12.      * @ORM\Column(type="integer")
  13.      */
  14.     private $id;
  15.     /**
  16.      * @ORM\Column(type="string", length=255, nullable=true)
  17.      */
  18.     private $companyName;
  19.     /**
  20.      * @ORM\ManyToOne(targetEntity="App\Entity\Industry")
  21.      */
  22.     private $industry;
  23.     /**
  24.      * @ORM\Column(type="string", length=255, nullable=true)
  25.      */
  26.     private $position;
  27.     /**
  28.      * @ORM\Column(type="text")
  29.      */
  30.     private $description;
  31.     /**
  32.      * @ORM\Column(type="date")
  33.      */
  34.     private $dateFrom;
  35.     /**
  36.      * @ORM\Column(type="date", nullable=true)
  37.      */
  38.     private $dateTo;
  39.     /**
  40.      * @ORM\ManyToOne(targetEntity="App\Entity\Candidate", inversedBy="workExperiences")
  41.      */
  42.     private $candidate;
  43.     /**
  44.      * @return int|null
  45.      */
  46.     public function getId(): ?int {
  47.         return $this->id;
  48.     }
  49.     /**
  50.      * @param int $id
  51.      *
  52.      * @return WorkExperience
  53.      */
  54.     public function setId(int $id): WorkExperience {
  55.         $this->id = $id;
  56.         return $this;
  57.     }
  58.     /**
  59.      * @return string|null
  60.      */
  61.     public function getCompanyName(): ?string {
  62.         return $this->companyName;
  63.     }
  64.     /**
  65.      * @param string $companyName
  66.      *
  67.      * @return WorkExperience
  68.      */
  69.     public function setCompanyName(string $companyName): WorkExperience {
  70.         $this->companyName = $companyName;
  71.         return $this;
  72.     }
  73.     /**
  74.      * @return Industry|null
  75.      */
  76.     public function getIndustry(): ?Industry {
  77.         return $this->industry;
  78.     }
  79.     /**
  80.      * @param Industry $industry
  81.      *
  82.      * @return WorkExperience
  83.      */
  84.     public function setIndustry(Industry $industry): WorkExperience {
  85.         $this->industry = $industry;
  86.         return $this;
  87.     }
  88.     /**
  89.      * @return string|null
  90.      */
  91.     public function getPosition(): ?string {
  92.         return $this->position;
  93.     }
  94.     /**
  95.      * @param string $position
  96.      *
  97.      * @return WorkExperience
  98.      */
  99.     public function setPosition(string $position): WorkExperience {
  100.         $this->position = $position;
  101.         return $this;
  102.     }
  103.     /**
  104.      * @return string|null
  105.      */
  106.     public function getDescription(): ?string {
  107.         return $this->description;
  108.     }
  109.     /**
  110.      * @param string $description
  111.      *
  112.      * @return WorkExperience
  113.      */
  114.     public function setDescription(string $description): WorkExperience {
  115.         $this->description = $description;
  116.         return $this;
  117.     }
  118.     /**
  119.      * @return \DateTime|null
  120.      */
  121.     public function getDateFrom(): ?\DateTime {
  122.         return $this->dateFrom;
  123.     }
  124.     /**
  125.      * @param \DateTime $dateFrom
  126.      *
  127.      * @return WorkExperience
  128.      */
  129.     public function setDateFrom(\DateTime $dateFrom): WorkExperience {
  130.         $this->dateFrom = $dateFrom;
  131.         return $this;
  132.     }
  133.     /**
  134.      * @return \DateTime|null
  135.      */
  136.     public function getDateTo(): ?\DateTime {
  137.         return $this->dateTo;
  138.     }
  139.     /**
  140.      * @param \DateTime $dateTo
  141.      *
  142.      * @return WorkExperience
  143.      */
  144.     public function setDateTo(?\DateTime $dateTo): WorkExperience {
  145.         $this->dateTo = $dateTo;
  146.         return $this;
  147.     }
  148.     /**
  149.      * @return Candidate|null
  150.      */
  151.     public function getCandidate(): ?Candidate {
  152.         return $this->candidate;
  153.     }
  154.     /**
  155.      * @param Candidate $candidate
  156.      *
  157.      * @return WorkExperience
  158.      */
  159.     public function setCandidate(Candidate $candidate): WorkExperience {
  160.         $this->candidate = $candidate;
  161.         return $this;
  162.     }
  163.     public function __toString() {
  164.         return $this->getCompanyName();
  165.     }
  166.     /**
  167.      * Specify data which should be serialized to JSON
  168.      *
  169.      * @link https://php.net/manual/en/jsonserializable.jsonserialize.php
  170.      * @return mixed data which can be serialized by <b>json_encode</b>,
  171.      * which is a value of any type other than a resource.
  172.      * @since 5.4.0
  173.      */
  174.     public function jsonSerialize() {
  175.         return [
  176.             'id' => $this->getId(),
  177.             'companyName' => $this->getCompanyName(),
  178.             'industry' => $this->getIndustry()->getId(),
  179.             'position' => $this->getPosition(),
  180.             'description' => $this->getDescription(),
  181.             'dateFrom' => $this->getDateFrom(),
  182.             'dateTo' => $this->getDateTo()
  183.         ];
  184.     }
  185. }