<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\EducationRepository")
*/
class Education implements \JsonSerializable
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\EducationLevel")
*/
private $level;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="string", length=255)
*/
private $country;
/**
* @ORM\Column(type="string", length=255)
*/
private $city;
/**
* @ORM\Column(type="string", length=255)
*/
private $fieldOfStudy;
/**
* @ORM\Column(type="date")
*/
private $dateFrom;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $dateTo;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Candidate", inversedBy="educations")
*/
private $candidate;
/**
* @return int|null
*/
public function getId(): ?int {
return $this->id;
}
/**
* @param int $id
*
* @return Education
*/
public function setId(int $id): Education {
$this->id = $id;
return $this;
}
/**
* @return EducationLevel|null
*/
public function getLevel(): ?EducationLevel {
return $this->level;
}
/**
* @param EducationLevel $level
*
* @return Education
*/
public function setLevel(EducationLevel $level): Education {
$this->level = $level;
return $this;
}
/**
* @return string|null
*/
public function getName(): ?string {
return $this->name;
}
/**
* @param string $name
*
* @return Education
*/
public function setName(string $name): Education {
$this->name = $name;
return $this;
}
/**
* @return string|null
*/
public function getCountry(): ?string {
return $this->country;
}
/**
* @param string $country
*
* @return Education
*/
public function setCountry(string $country): Education {
$this->country = $country;
return $this;
}
/**
* @return string|null
*/
public function getCity(): ?string {
return $this->city;
}
/**
* @param string $city
*
* @return Education
*/
public function setCity(string $city): Education {
$this->city = $city;
return $this;
}
/**
* @return string|null
*/
public function getFieldOfStudy(): ?string {
return $this->fieldOfStudy;
}
/**
* @param string $fieldOfStudy
*
* @return Education
*/
public function setFieldOfStudy(string $fieldOfStudy): Education {
$this->fieldOfStudy = $fieldOfStudy;
return $this;
}
/**
* @return \DateTime|null
*/
public function getDateFrom(): ?\DateTime {
return $this->dateFrom;
}
/**
* @param \DateTime $dateFrom
*
* @return Education
*/
public function setDateFrom(\DateTime $dateFrom): Education {
$this->dateFrom = $dateFrom;
return $this;
}
/**
* @return \DateTime|null
*/
public function getDateTo(): ?\DateTime {
return $this->dateTo;
}
/**
* @param \DateTime $dateTo
*
* @return Education
*/
public function setDateTo(?\DateTime $dateTo): Education {
$this->dateTo = $dateTo;
return $this;
}
/**
* @return Candidate
*/
public function getCandidate(): ?Candidate {
return $this->candidate;
}
/**
* @param Candidate $candidate
*
* @return Education
*/
public function setCandidate(Candidate $candidate): Education {
$this->candidate = $candidate;
return $this;
}
public function __toString() {
return $this->getName();
}
/**
* Specify data which should be serialized to JSON
*
* @link https://php.net/manual/en/jsonserializable.jsonserialize.php
* @return mixed data which can be serialized by <b>json_encode</b>,
* which is a value of any type other than a resource.
* @since 5.4.0
*/
public function jsonSerialize() {
return [
'id' => $this->getId(),
'name' => $this->getName(),
'level' => $this->getLevel(),
'country' => $this->getCountry(),
'city' => $this->getCity(),
'fieldOfStudy' => $this->getFieldOfStudy(),
'dateFrom' => $this->getDateFrom(),
'dateTo' => $this->getDateTo(),
];
}
}