119 lines
2.2 KiB
PHP

<?php
namespace Chill\PersonBundle\Entity;
use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\Mapping as ORM;
/**
* Person Phones
*
* @ORM\Entity
* @ORM\Table(name="chill_person_phone",
* indexes={
* @ORM\Index(name="phonenumber", columns={"phonenumber"})
* })
*/
class PersonPhone
{
/**
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private ?int $id;
/**
* @ORM\ManyToOne(
* targetEntity="Chill\PersonBundle\Entity\Person",
* inversedBy="otherPhoneNumbers"
* )
*/
private Person $person;
/**
* @ORM\Column(type="text", length=40, nullable=true)
*/
private ?string $type;
/**
* @ORM\Column(type="text", length=40, nullable=false)
*/
private string $phonenumber = '';
/**
* @ORM\Column(type="text", nullable=true)
*/
private ?string $description = null;
/**
* @ORM\Column(type="datetime", nullable=false)
*/
private \DateTime $date;
public function __construct()
{
$this->date = new \DateTime();
}
public function getId(): int
{
return $this->id;
}
public function getPerson(): Person
{
return $this->person;
}
public function setPerson(Person $person): void
{
$this->person = $person;
}
public function getType(): string
{
return $this->type;
}
public function setType(string $type): void
{
$this->type = $type;
}
public function getPhonenumber(): string
{
return $this->phonenumber;
}
public function setPhonenumber(string $phonenumber): void
{
$this->phonenumber = $phonenumber;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): void
{
$this->description = $description;
}
public function getDate(): \DateTime
{
return $this->date;
}
public function setDate(\DateTime $date): void
{
$this->date = $date;
}
public function isEmpty(): bool
{
return empty($this->getDescription()) && empty($this->getPhonenumber());
}
}