<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\WorkExperienceRepository")
*/
class WorkExperience implements \JsonSerializable
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $companyName;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Industry")
*/
private $industry;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $position;
/**
* @ORM\Column(type="text")
*/
private $description;
/**
* @ORM\Column(type="date")
*/
private $dateFrom;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $dateTo;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Candidate", inversedBy="workExperiences")
*/
private $candidate;
/**
* @return int|null
*/
public function getId(): ?int {
return $this->id;
}
/**
* @param int $id
*
* @return WorkExperience
*/
public function setId(int $id): WorkExperience {
$this->id = $id;
return $this;
}
/**
* @return string|null
*/
public function getCompanyName(): ?string {
return $this->companyName;
}
/**
* @param string $companyName
*
* @return WorkExperience
*/
public function setCompanyName(string $companyName): WorkExperience {
$this->companyName = $companyName;
return $this;
}
/**
* @return Industry|null
*/
public function getIndustry(): ?Industry {
return $this->industry;
}
/**
* @param Industry $industry
*
* @return WorkExperience
*/
public function setIndustry(Industry $industry): WorkExperience {
$this->industry = $industry;
return $this;
}
/**
* @return string|null
*/
public function getPosition(): ?string {
return $this->position;
}
/**
* @param string $position
*
* @return WorkExperience
*/
public function setPosition(string $position): WorkExperience {
$this->position = $position;
return $this;
}
/**
* @return string|null
*/
public function getDescription(): ?string {
return $this->description;
}
/**
* @param string $description
*
* @return WorkExperience
*/
public function setDescription(string $description): WorkExperience {
$this->description = $description;
return $this;
}
/**
* @return \DateTime|null
*/
public function getDateFrom(): ?\DateTime {
return $this->dateFrom;
}
/**
* @param \DateTime $dateFrom
*
* @return WorkExperience
*/
public function setDateFrom(\DateTime $dateFrom): WorkExperience {
$this->dateFrom = $dateFrom;
return $this;
}
/**
* @return \DateTime|null
*/
public function getDateTo(): ?\DateTime {
return $this->dateTo;
}
/**
* @param \DateTime $dateTo
*
* @return WorkExperience
*/
public function setDateTo(?\DateTime $dateTo): WorkExperience {
$this->dateTo = $dateTo;
return $this;
}
/**
* @return Candidate|null
*/
public function getCandidate(): ?Candidate {
return $this->candidate;
}
/**
* @param Candidate $candidate
*
* @return WorkExperience
*/
public function setCandidate(Candidate $candidate): WorkExperience {
$this->candidate = $candidate;
return $this;
}
public function __toString() {
return $this->getCompanyName();
}
/**
* 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(),
'companyName' => $this->getCompanyName(),
'industry' => $this->getIndustry()->getId(),
'position' => $this->getPosition(),
'description' => $this->getDescription(),
'dateFrom' => $this->getDateFrom(),
'dateTo' => $this->getDateTo()
];
}
}