src/Entity/Education.php line 225

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