<?phpnamespace App\Entity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use App\Entity\CommunicationEntry;class Communication { /** * @var int */ private $id; /** * @var \DateTime */ private $createdAt; /** * @var \Doctrine\Common\Collections\Collection */ private $communicationEntries; /** * Constructor */ public function __construct() { $this->communicationEntries = new \Doctrine\Common\Collections\ArrayCollection(); } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set createdAt * * @param \DateTime $createdAt * * @return Communication */ public function setCreatedAt($createdAt) { $this->createdAt = $createdAt; return $this; } /** * Get createdAt * * @return \DateTime */ public function getCreatedAt() { return $this->createdAt; } /** * Add communicationEntry * * @param \App\Entity\CommunicationEntry $communicationEntry * * @return Communication */ public function addCommunicationEntry(\App\Entity\CommunicationEntry $communicationEntry) { $this->communicationEntries[] = $communicationEntry; return $this; } /** * Remove communicationEntry * * @param \App\Entity\CommunicationEntry $communicationEntry */ public function removeCommunicationEntry(\App\Entity\CommunicationEntry $communicationEntry) { $this->communicationEntries->removeElement($communicationEntry); } /** * Get communicationEntries * * @return \Doctrine\Common\Collections\Collection */ public function getCommunicationEntries() { return $this->communicationEntries; } /** * Get tele business * * @return string */ public function getMobileBusiness() { /* @var $commEntry CommunicationEntry */ foreach ($this->communicationEntries as $commEntry) { if ($commEntry->getCommunicationType()->getId() == 4) { return $commEntry->getEntryValue(); } } return ''; } /** * Get tele business * * @return string */ public function getPhoneBusiness() { /* @var $commEntry CommunicationEntry */ foreach ($this->communicationEntries as $commEntry) { if ($commEntry->getCommunicationType()->getId() == 2) { return $commEntry->getEntryValue(); } } return ''; } /** * Get mail business * * @return string */ public function getMailBusiness() { /* @var $commEntry CommunicationEntry */ foreach ($this->communicationEntries as $commEntry) { if ($commEntry->getCommunicationType()->getId() == 6) { return $commEntry->getEntryValue(); } } return ''; } /** * Get mail business * * @return string */ public function getMailDirector() { /* @var $commEntry CommunicationEntry */ foreach ($this->communicationEntries as $commEntry) { if ($commEntry->getCommunicationType()->getId() == 9) { return $commEntry->getEntryValue(); } } return ''; } public function __toString(): string { return "Communication[id=" . $this->id . ", createdAt=" . $this->createdAt->format('d.m.Y H:i:s') . "]"; }}