<?php
namespace MedBrief\MSR\Entity;
use DH\Auditor\Provider\Doctrine\Auditing\Annotation as Audit;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use MedBrief\MSR\Repository\ContactableAddressRepository;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* ContactableAddress
*
* @ORM\Table(name="ContactableAddress")
*
* @ORM\Entity(repositoryClass=ContactableAddressRepository::class)
*
* @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false)
*
* @Audit\Auditable
*
* @Audit\Security(view={"ROLE_ALLOWED_TO_AUDIT"})
*/
class ContactableAddress
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\Id
*
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var \DateTime|null
*
* @ORM\Column(name="deletedAt", type="datetime", nullable=true)
*/
private $deletedAt;
/**
* @var string
*
* @ORM\Column(name="name", type="string")
*/
private $name;
/**
* @var string
*/
private $contact_full_name;
/**
* @var string
*/
private $email;
/**
* @var string
*/
private $phone;
/**
* @var string
*
* @Groups({"account:read", "matter_request:read"})
*
* @ORM\Column(name="contact_name", type="string", nullable=true)
*/
private $contact_name;
/**
* @var string|null
*
* @ORM\Column(name="contact_email", type="string", nullable=true)
*/
private $contact_email;
/**
* @Groups({"account:read", "matter_request:read"})
*
* @var string|null
*
* @ORM\Column(name="contact_phone", type="string", nullable=true)
*/
private $contact_phone;
/**
* @Groups({"account:read", "matter_request:read"})
*
* @var string|null
*
* @ORM\Column(name="line1", type="string", nullable=true)
*/
private $line1;
/**
* @Groups({"account:read", "matter_request:read"})
*
* @var string|null
*
* @ORM\Column(name="line2", type="string", nullable=true)
*/
private $line2;
/**
* @Groups({"account:read", "matter_request:read"})
*
* @var string|null
*
* @ORM\Column(name="city", type="string", nullable=true)
*/
private $city;
/**
* @Groups({"account:read", "matter_request:read"})
*
* @var string|null
*
* @ORM\Column(name="postal_code", type="string", nullable=true)
*/
private $postal_code;
/**
* @var string
*
* @ORM\Column(name="country", type="string")
*/
private $country;
/**
* @var string|null
*
* @ORM\Column(name="province", type="string", nullable=true)
*/
private $province;
/**
* @var \DateTime
*
* @ORM\Column(name="created", type="datetime")
*
* @Gedmo\Timestampable(on="create")
*/
private $created;
/**
* @var \DateTime
*
* @ORM\Column(name="updated", type="datetime")
*
* @Gedmo\Timestampable(on="update")
*/
private $updated;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\ManyToMany(targetEntity="MedBrief\MSR\Entity\Account", mappedBy="offices")
*/
private $accounts;
/**
* Constructor
*/
public function __construct()
{
$this->accounts = new \Doctrine\Common\Collections\ArrayCollection();
}
public function __toString()
{
return $this->getName();
}
/**
* Get id
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return ContactableAddress
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set contact_full_name
*
* @param string $contactFullName
*
* @return ContactableAddress
*/
public function setContactFullName($contactFullName)
{
$this->contact_full_name = $contactFullName;
return $this;
}
/**
* Get contact_full_name
*
* @return string
*/
public function getContactFullName()
{
return $this->contact_full_name;
}
/**
* Set email
*
* @param string $email
*
* @return ContactableAddress
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Get email
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* Set phone
*
* @param string $phone
*
* @return ContactableAddress
*/
public function setPhone($phone)
{
$this->phone = $phone;
return $this;
}
/**
* Get phone
*
* @return string
*/
public function getPhone()
{
return $this->phone;
}
/**
* Set line1
*
* @param string $line1
*
* @return ContactableAddress
*/
public function setLine1($line1)
{
$this->line1 = $line1;
return $this;
}
/**
* Get line1
*
* @return string
*/
public function getLine1()
{
return $this->line1;
}
/**
* Set line2
*
* @param string $line2
*
* @return ContactableAddress
*/
public function setLine2($line2)
{
$this->line2 = $line2;
return $this;
}
/**
* Get line2
*
* @return string
*/
public function getLine2()
{
return $this->line2;
}
/**
* Set city
*
* @param string $city
*
* @return ContactableAddress
*/
public function setCity($city)
{
$this->city = $city;
return $this;
}
/**
* Get city
*
* @return string
*/
public function getCity()
{
return $this->city;
}
/**
* Set postal_code
*
* @param string $postalCode
*
* @return ContactableAddress
*/
public function setPostalCode($postalCode)
{
$this->postal_code = $postalCode;
return $this;
}
/**
* Get postal_code
*
* @return string
*/
public function getPostalCode()
{
return $this->postal_code;
}
/**
* Set country
*
* @param string $country
*
* @return ContactableAddress
*/
public function setCountry($country)
{
$this->country = $country;
return $this;
}
/**
* Get country
*
* @return string
*/
public function getCountry()
{
return $this->country;
}
/**
* Set created
*
* @param \DateTime $created
*
* @return ContactableAddress
*/
public function setCreated($created)
{
$this->created = $created;
return $this;
}
/**
* Get created
*
* @return \DateTime
*/
public function getCreated()
{
return $this->created;
}
/**
* Set updated
*
* @param \DateTime $updated
*
* @return ContactableAddress
*/
public function setUpdated($updated)
{
$this->updated = $updated;
return $this;
}
/**
* Get updated
*
* @return \DateTime
*/
public function getUpdated()
{
return $this->updated;
}
/**
* Set province
*
* @param string $province
*
* @return ContactableAddress
*/
public function setProvince($province)
{
$this->province = $province;
return $this;
}
/**
* Get province
*
* @return string
*/
public function getProvince()
{
return $this->province;
}
/**
* Add accounts
*
* @param Account $accounts
*
* @return ContactableAddress
*/
public function addAccount(Account $accounts)
{
$this->accounts[] = $accounts;
return $this;
}
/**
* Remove accounts
*
* @param Account $accounts
*/
public function removeAccount(Account $accounts)
{
$this->accounts->removeElement($accounts);
}
/**
* Get accounts
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getAccounts()
{
return $this->accounts;
}
/**
* Set contact_name
*
* @param string $contactName
*
* @return ContactableAddress
*/
public function setContactName($contactName)
{
$this->contact_name = $contactName;
return $this;
}
/**
* Get contact_name
*
* @return string
*/
public function getContactName()
{
return $this->contact_name;
}
/**
* Set contact_email
*
* @param string $contactEmail
*
* @return ContactableAddress
*/
public function setContactEmail($contactEmail)
{
$this->contact_email = $contactEmail;
return $this;
}
/**
* Get contact_email
*
* @return string
*/
public function getContactEmail()
{
return $this->contact_email;
}
/**
* Set contact_phone
*
* @param string $contactPhone
*
* @return ContactableAddress
*/
public function setContactPhone($contactPhone)
{
$this->contact_phone = $contactPhone;
return $this;
}
/**
* Get contact_phone
*
* @return string
*/
public function getContactPhone()
{
return $this->contact_phone;
}
/**
* Returns the formatted address
*
* @param bool $inline
*
* @return string
*/
public function getFormatted(bool $inline = false): string
{
$separator = $inline ? ', ' : '<br>';
$formattedStr
= ($this->getLine1() ? $this->getLine1() . $separator : '')
. ($this->getLine2() ? $this->getLine2() . $separator : '')
. ($this->getCity() ? $this->getCity() . $separator : '')
. ($this->getProvince() ? $this->getProvince() . $separator : '')
. ($this->getCountry() ? $this->getCountry() . $separator : '')
. ($this->getPostalCode() ? $this->getPostalCode() . $separator : '');
return trim($formattedStr, $separator);
}
/**
* Set deletedAt
*
* @param \DateTime $deletedAt
*
* @return ContactableAddress
*/
public function setDeletedAt($deletedAt)
{
$this->deletedAt = $deletedAt;
return $this;
}
/**
* Get deletedAt
*
* @return \DateTime
*/
public function getDeletedAt()
{
return $this->deletedAt;
}
}