<?php
declare(strict_types=1);
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\ContactRepository;
/**
* Contact
*
* @ORM\Table(name="contact", indexes={@ORM\Index(name="sourceID", columns={"source_id"}), @ORM\Index(name="csptypeID", columns={"csptype_id"}), @ORM\Index(name="lock_user", columns={"lock_user"}), @ORM\Index(name="countryID", columns={"country_id"}), @ORM\Index(name="cspID", columns={"csp_id"})})
* @ORM\Entity(repositoryClass=ContactRepository::class)
* @ORM\HasLifecycleCallbacks()
*/
class Contact
{
public const TITLE_MR = 'Mr';
public const TITLE_MS = 'Ms';
public const TITLE_MRS = 'Mrs';
public const TITLE_PR = 'Pr';
public const TITLE_DR = 'Dr';
public const OPERATION_CLONE = 'clone';
public const OPERATION_UPDATE = 'update';
public const OPERATION_RELATED = 'related';
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $id;
/**
* @var string|null
*
* @ORM\Column(name="title", type="string", length=4, nullable=true, options={"default"="NULL"})
*/
private $title = null;
/**
* @var string|null
*
* @ORM\Column(name="fname", type="string", length=40, nullable=true, options={"default"="NULL"})
*/
private $fname = null;
/**
* @var string|null
*
* @ORM\Column(name="lname", type="string", length=40, nullable=true, options={"default"="NULL"})
*/
private $lname = null;
/**
* @var string|null
*
* @ORM\Column(name="email", type="string", length=64, nullable=true, options={"default"="NULL"})
*/
private $email = null;
/**
* @var bool
*
* @ORM\Column(name="valid_email", type="boolean", nullable=false, options={"default"="1"})
*/
private $validEmail = true;
/**
* @var string|null
*
* @ORM\Column(name="position", type="string", length=110, nullable=true, options={"default"="NULL"})
*/
private $position = null;
/**
* @var string|null
*
* @ORM\Column(name="division", type="string", length=80, nullable=true, options={"default"="NULL"})
*/
private $division = null;
/**
* @var string|null
*
* @ORM\Column(name="phone1", type="string", length=100, nullable=true, options={"default"="NULL"})
*/
private $phone1 = null;
/**
* @var string|null
*
* @ORM\Column(name="phone2", type="string", length=100, nullable=true, options={"default"="NULL"})
*/
private $phone2 = null;
/**
* @var string|null
*
* @ORM\Column(name="corp_phone", type="string", length=100, nullable=true, options={"default"="NULL"})
*/
private $corpPhone = null;
/**
* @var string|null
*
* @ORM\Column(name="linkedin_url", type="string", length=120, nullable=true, options={"default"="NULL"})
*/
private $linkedinUrl = null;
/**
* @var string|null
*
* @ORM\Column(name="city", type="string", length=64, nullable=true, options={"default"="NULL"})
*/
private $city = null;
/**
* @var string|null
*
* @ORM\Column(name="comment", type="text", length=65535, nullable=true, options={"default"="NULL"})
*/
private $comment = null;
/**
* @var \DateTime|null
*
* @ORM\Column(name="lock_date", type="datetime", nullable=true, options={"default"="NULL"})
*/
private $lockDate = null;
/**
* @var \DateTime|null
*
* @ORM\Column(name="updated_at", type="datetime", nullable=true, options={"default"="NULL"})
*/
private $updatedAt = null;
/**
* @var \DateTime|null
*
* @ORM\Column(name="missing_data", type="datetime", nullable=true, options={"default"="NULL"})
*/
private $missingData = null;
/**
* @var bool|null
*
* @ORM\Column(name="last_import", type="boolean", nullable=true)
*/
private $lastImport = false;
/**
* @var bool
*
* @ORM\Column(name="trash", type="boolean", nullable=false)
*/
private $trash = false;
/**
* @var bool
*
* @ORM\Column(name="last_delete", type="boolean", nullable=false)
*/
private $lastDelete = false;
/**
* @var \Country
*
* @ORM\ManyToOne(targetEntity="Country")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="country_id", referencedColumnName="id")
* })
*/
private $country;
/**
* @var \Source
*
* @ORM\ManyToOne(targetEntity="Source")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="source_id", referencedColumnName="id")
* })
*/
private $source;
/**
* @var \Csp
*
* @ORM\ManyToOne(targetEntity="Csp")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="csp_id", referencedColumnName="id")
* })
*/
private $csp;
/**
* @var \Csptype
*
* @ORM\ManyToOne(targetEntity="Csptype")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="csptype_id", referencedColumnName="id")
* })
*/
private $csptype;
/**
* @var \User
*
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="lock_user", referencedColumnName="id")
* })
*/
private $lockUser;
/**
* @var \Doctrine\Common\Collections\Collection
*
* @ORM\ManyToMany(targetEntity="Conference", mappedBy="contact")
*/
//private $conference;
/**
* @ORM\OneToMany(targetEntity="RelatedContact", mappedBy="parentContact", fetch="EXTRA_LAZY")
*/
private $relatedContacts;
/**
* @ORM\OneToMany(targetEntity="RelatedContact", mappedBy="relatedContact", fetch="EXTRA_LAZY")
*/
private $parentContacts;
/**
* @ORM\OneToMany(targetEntity="ContactCompanyType", mappedBy="contact", fetch="EXTRA_LAZY")
*/
private $companyTypes;
/**
* Constructor
*/
public function __construct()
{
$this->relatedContacts = new ArrayCollection();
$this->parentContacts = new ArrayCollection();
$this->companyTypes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getFname(): ?string
{
return $this->fname;
}
public function setFname(?string $fname): self
{
$this->fname = $fname;
return $this;
}
public function getLname(): ?string
{
return $this->lname;
}
public function setLname(?string $lname): self
{
$this->lname = $lname;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(?string $email): self
{
$this->email = $email;
return $this;
}
public function isValidEmail(): ?bool
{
return $this->validEmail;
}
public function setValidEmail(bool $validEmail): self
{
$this->validEmail = $validEmail;
return $this;
}
public function getPosition(): ?string
{
return $this->position;
}
public function setPosition(?string $position): self
{
$this->position = $position;
return $this;
}
public function getDivision(): ?string
{
return $this->division;
}
public function setDivision(?string $division): self
{
$this->division = $division;
return $this;
}
public function getPhone1(): ?string
{
return $this->phone1;
}
public function setPhone1(?string $phone1): self
{
$this->phone1 = $phone1;
return $this;
}
public function getPhone2(): ?string
{
return $this->phone2;
}
public function setPhone2(?string $phone2): self
{
$this->phone2 = $phone2;
return $this;
}
public function getCorpPhone(): ?string
{
return $this->corpPhone;
}
public function setCorpPhone(?string $corpPhone): self
{
$this->corpPhone = $corpPhone;
return $this;
}
public function getLinkedinUrl(): ?string
{
return $this->linkedinUrl;
}
public function setLinkedinUrl(?string $linkedinUrl): self
{
$this->linkedinUrl = $linkedinUrl;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): self
{
$this->city = $city;
return $this;
}
public function getComment(): ?string
{
return $this->comment;
}
public function setComment(?string $comment): self
{
$this->comment = $comment;
return $this;
}
public function getLockDate(): ?\DateTimeInterface
{
return $this->lockDate;
}
public function setLockDate(?\DateTimeInterface $lockDate): self
{
$this->lockDate = $lockDate;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
/**
* @ORM\PrePersist
*/
public function setUpdatedAt(): self
{
$this->updatedAt = new \DateTimeImmutable();
return $this;
}
public function getMissingData(): ?\DateTimeInterface
{
return $this->missingData;
}
public function setMissingData(?\DateTimeInterface $missingData): self
{
$this->missingData = $missingData;
return $this;
}
public function isLastImport(): ?bool
{
return $this->lastImport;
}
public function setLastImport(?bool $lastImport): self
{
$this->lastImport = $lastImport;
return $this;
}
public function isTrash(): ?bool
{
return $this->trash;
}
public function setTrash(bool $trash): self
{
$this->trash = $trash;
return $this;
}
public function isLastDelete(): ?bool
{
return $this->lastDelete;
}
public function setLastDelete(bool $lastDelete): self
{
$this->lastDelete = $lastDelete;
return $this;
}
public function getCountry(): ?Country
{
return $this->country;
}
public function setCountry(?Country $country): self
{
$this->country = $country;
return $this;
}
public function getSource(): ?Source
{
return $this->source;
}
public function setSource(?Source $source): self
{
$this->source = $source;
return $this;
}
public function getCsp(): ?Csp
{
return $this->csp;
}
public function setCsp(?Csp $csp): self
{
$this->csp = $csp;
return $this;
}
public function getCsptype(): ?Csptype
{
return $this->csptype;
}
public function setCsptype(?Csptype $csptype): self
{
$this->csptype = $csptype;
return $this;
}
public function getLockUser(): ?User
{
return $this->lockUser;
}
public function setLockUser(?User $lockUser): self
{
$this->lockUser = $lockUser;
return $this;
}
/**
* @return Collection<int, Conference>
*/
/*public function getConference(): Collection
{
return $this->conference;
}
public function addConference(Conference $conference): self
{
if (!$this->conference->contains($conference)) {
$this->conference[] = $conference;
$conference->addContact($this);
}
return $this;
}
public function removeConference(Conference $conference): self
{
if ($this->conference->removeElement($conference)) {
$conference->removeContact($this);
}
return $this;
}*/
/**
* @return Collection<int, RelatedContact>
*/
public function getRelatedContacts(): Collection
{
return $this->relatedContacts;
}
public function addRelatedContact(RelatedContact $relatedContact): self
{
if (!$this->relatedContacts->contains($relatedContact)) {
$this->relatedContacts[] = $relatedContact;
$relatedContact->setParentContact($this);
}
return $this;
}
public function removeRelatedContact(RelatedContact $relatedContact): self
{
if ($this->relatedContacts->removeElement($relatedContact)) {
// set the owning side to null (unless already changed)
if ($relatedContact->getParentContact() === $this) {
$relatedContact->setParentContact(null);
}
}
return $this;
}
/**
* @return Collection<int, RelatedContact>
*/
public function getParentContacts(): Collection
{
return $this->parentContacts;
}
public function addParentContact(RelatedContact $parentContact): self
{
if (!$this->parentContacts->contains($parentContact)) {
$this->parentContacts[] = $parentContact;
$parentContact->setRelatedContact($this);
}
return $this;
}
public function removeParentContact(RelatedContact $parentContact): self
{
if ($this->parentContacts->removeElement($parentContact)) {
// set the owning side to null (unless already changed)
if ($parentContact->getRelatedContact() === $this) {
$parentContact->setRelatedContact(null);
}
}
return $this;
}
public function equals(Contact $contact): bool
{
if (
$this->getFname() === $contact->getFname()
&& $this->getLname() === $contact->getLname()
&& $this->getEmail() === $contact->getEmail()
&& $this->getLinkedinUrl() === $contact->getLinkedinUrl()
&& $this->getPhone1() === $contact->getPhone1()
&& $this->getPhone2() === $contact->getPhone2()
&& $this->isValidEmail() === $contact->isValidEmail()
&& $this->getPosition() === $contact->getPosition()
) {
return true;
}
return false;
}
/**
* @return Collection<int, ContactCompanyType>
*/
public function getCompanyTypes(): Collection
{
return $this->companyTypes;
}
public function addCompanyType(ContactCompanyType $companyType): self
{
if (!$this->companyTypes->contains($companyType)) {
$this->companyTypes->add($companyType);
$companyType->setContact($this);
}
return $this;
}
public function removeCompanyType(ContactCompanyType $companyType): self
{
if ($this->companyTypes->removeElement($companyType)) {
// set the owning side to null (unless already changed)
if ($companyType->getContact() === $this) {
$companyType->setContact(null);
}
}
return $this;
}
}