<?php
namespace App\Entity;
use App\Entity\Dto\CheckoutDto;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as JMS;
use Menke\CommonsBundle\Entity\GenericEntity;
use Menke\UserBundle\Entity\Client;
use Menke\UserBundle\Entity\User;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\PersonRepository")
* @JMS\ExclusionPolicy("all")
*/
class Person extends GenericEntity
{
const INVOICE_RECIPIENT = 'invoice_recipient';
/**
* @ORM\OneToOne(targetEntity="Menke\UserBundle\Entity\User", cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=true)
*/
protected $user;
/**
* @ORM\Column(type="string", length=100, nullable=true)
* @JMS\Expose
* @JMS\Groups({"family"})
*/
protected $title;
/**
* @ORM\Column(type="string", length=32, nullable=true)
* @JMS\Expose
* @JMS\Groups({"family"})
*/
private $salutation;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @JMS\Expose
* @JMS\Groups({"family"})
*/
private $member;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @JMS\Expose
* @JMS\Groups({"family"})
*/
protected $firstname;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @JMS\Expose
* @JMS\Groups({"family"})
*/
protected $lastname;
/**
* @ORM\Column(type="date", nullable=true)
* @JMS\Expose
* @JMS\Groups({"family"})
*/
protected $dateOfBirth;
/**
* @ORM\Column(type="string", length=128, nullable=true)
* @JMS\Expose
* @JMS\Groups({"family"})
*/
protected $cityOfBirth;
/**
* @ORM\Column(type="text", nullable=true)
* @JMS\Expose
* @JMS\Groups({"family"})
*/
protected $comment;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $isMainContact;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $isSpeaker = false;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $isCustomer = false;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $street;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
protected $streetNumber;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
protected $postalcode;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @JMS\Expose
* @JMS\Groups({"family"})
*/
protected $city;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $contactEmail;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $web;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
protected $country;
/**
* @ORM\Column(type="string", length=30, nullable=true)
*/
protected $phone;
/**
* @ORM\Column(type="string", length=30, nullable=true)
*/
protected $mobile;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
protected $deleteDate;
/**
* @var string
* @ORM\Column(type="string", length=30, nullable=true)
* @Assert\Iban(
* message="Kein legales IBAN format."
* )
*/
protected $iban;
/**
* @ORM\Column(type="string", length=20, nullable=true)
*/
protected $bic;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $bank;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $debitAgree;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
protected $debitAgreeSource;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
protected $debitAgreeDate;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $emailInvoice;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Order", mappedBy="customer")
*/
protected $orders;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\CourseOccurrence", inversedBy="customers")
*/
protected $courses;
/**
* @ORM\OneToMany(targetEntity="App\Entity\CustomerHistoryEntry", mappedBy="customer", orphanRemoval=true, cascade={"all"})
*/
protected $history;
/**
* @ORM\OneToMany(targetEntity="App\Entity\CustomerDocument", mappedBy="customer", orphanRemoval=true, cascade={"all"})
*/
protected $documents;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Person", cascade={"all"})
*/
protected $familyMemberOf;
/**
* @ORM\OneToOne(targetEntity="App\Entity\Speaker", mappedBy="person")
*/
protected $speaker;
/**
* @ORM\Column(type="boolean")
*/
protected $privacyPolicyConfirmed = false;
/**
* @ORM\Column(type="boolean")
*/
protected $receiveNewsletter = false;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
protected $debitActive = 0;
/**
* @ORM\OneToMany(targetEntity=ManualNewsletter::class, mappedBy="person")
*/
private $manual_newsletter;
/**
* @ORM\OneToMany(targetEntity=InvoiceItemAttendees::class, mappedBy="person")
*/
private $invoice_item_attendees;
/**
* @ORM\Column(type="boolean")
*/
private $isInvoiceRecipient = 0;
/**
* @ORM\OneToMany(targetEntity=Invoice::class, mappedBy="invoiceAdressPerson")
*/
private $invoices;
/**
* @ORM\OneToMany(targetEntity=Order::class, mappedBy="invoiceRecipient")
*/
private $no;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $company;
/**
* @ORM\OneToMany(targetEntity=TagsPerson::class, mappedBy="person", orphanRemoval=true)
*/
private $persontags;
public function __toString() {
return $this->lastname;
}
public function __construct()
{
$this->orders = new ArrayCollection();
$this->courses = new ArrayCollection();
$this->history = new ArrayCollection();
$this->persontags = new ArrayCollection();
$this->documents = new ArrayCollection();
$this->manual_newsletter = new ArrayCollection();
$this->invoice_item_attendees = new ArrayCollection();
$this->invoices = new ArrayCollection();
$this->no = new ArrayCollection();
$this->signer = new ArrayCollection();
}
/**
* @param CheckoutDto $checkout
*
* @return Person
*/
public static function createFromCheckout(CheckoutDto $checkout)
{
$now = date("d.m.Y");
$entity = new self();
$entity->title = $checkout->customerTitle;
$entity->salutation = $checkout->customerSalutation;
$entity->member = $checkout->customerMember;
$entity->company = $checkout->customerCompany;
$entity->firstname = $checkout->customerFirstname;
$entity->lastname = $checkout->customerLastname;
if(!empty($checkout->customerComment)){
$entity->comment = $now . " : " . $checkout->customerComment . '<br>';}
else{
$entity->comment = '';
}
$entity->street = $checkout->customerStreet;
$entity->streetNumber = $checkout->customerStreetNumber;
$entity->postalcode = $checkout->customerPostalcode;
$entity->city = $checkout->customerCity;
$entity->contactEmail = $checkout->customerContactEmail;
$entity->phone = $checkout->customerPhone;
$entity->country = $checkout->customerCountry;
$entity->bic = $checkout->bic;
$entity->iban = $checkout->iban;
$entity->bank = $checkout->bank;
$entity->setCreated(new \datetime());
return $entity;
}
public function updateFromCheckout(CheckoutDto $checkout)
{
$now = date("d.m.Y");
$newComment = '';
if (empty($checkout->customerComment)) {
$newComment = $this->comment;
} else {
$newComment = $now . ': ' . $checkout->customerComment . '<br>' . $this->comment;
}
$this->title = $checkout->customerTitle;
$this->salutation = $checkout->customerSalutation;
$this->member = $checkout->customerMember;
$this->company = $checkout->customerCompany;
$this->firstname = $checkout->customerFirstname;
$this->lastname = $checkout->customerLastname;
$this->comment = $newComment;
$this->street = $checkout->customerStreet;
$this->streetNumber = $checkout->customerStreetNumber;
$this->postalcode = $checkout->customerPostalcode;
$this->city = $checkout->customerCity;
$this->contactEmail = $checkout->customerContactEmail;
$this->phone = $checkout->customerPhone;
$this->country = $checkout->customerCountry;
$this->bic = $checkout->bic;
$this->iban = $checkout->iban;
$this->bank = $checkout->bank;
$this->setModified(new \datetime());
}
/**
* updateOrderAddresses
*
* Updated the addresses of the orders. Only if they're on 'pending' or 'processing'
*
* @return array $res
*/
public function updateOrderAddresses()
{
$res = [];
foreach ($this->getOrders() as $order) {
if ($order->getStatus() == 'pending' || $order->getStatus() == 'processing') {
$order->setCustomerCompany($this->company);
$order->setCustomerTitle($this->title);
$order->setCustomerSalutation($this->salutation);
// sollen auch alle Orders die Mitgliedschaft aktualisieren?
// $order->setCustomerMember($this->member);
$order->setCustomerFirstname($this->firstname);
$order->setCustomerLastname($this->lastname);
$order->setCustomerStreet($this->street);
$order->setCustomerStreetNumber($this->streetNumber);
$order->setCustomerPostalcode($this->postalcode);
$order->setCustomerCity($this->city);
$order->setCustomerContactEmail($this->contactEmail);
$order->setCustomerPhone($this->phone);
$order->setCustomerCountry($this->country);
$order->setModified(new \datetime());
$res[] = $order;
}
}
return $res;
}
/**
* @return User
*/
public function getUser(): ?User
{
return $this->user;
}
/**
* @param User $user
* @return Person
*/
public function setUser($user): self
{
$this->user = $user;
return $this;
}
/**
* @return null|string
*/
public function getTitle(): ?string
{
return $this->title;
}
/**
* @param null|string $title
* @return Person
*/
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
/**
* @return null|string
*/
public function getSalutation(): ?string
{
return $this->salutation;
}
/**
* @param null|string $salutation
* @return Person
*/
public function setSalutation(?string $salutation): self
{
$this->salutation = $salutation;
return $this;
}
/**
* @return null|string
*/
public function getMember(): ?string
{
return $this->member;
}
/**
* @param null|string $member
* @return Person
*/
public function setMember(?string $member): self
{
$this->member = $member;
return $this;
}
/**
* @return null|string
*/
public function getFirstname(): ?string
{
return $this->firstname;
}
/**
* @param string $firstname
* @return Person
*/
public function setFirstname(?string $firstname): self
{
$this->firstname = $firstname;
return $this;
}
/**
* @return null|string
*/
public function getLastname(): ?string
{
return $this->lastname;
}
/**
* @param string $lastname
* @return Person
*/
public function setLastname(?string $lastname): self
{
$this->lastname = $lastname;
return $this;
}
/**
* @return null|string
*/
public function getComment(): ?string
{
return $this->comment;
}
/**
* @param string $comment
* @return Person
*/
public function setComment(?string $comment): self
{
$this->comment = $comment;
return $this;
}
/**
* @return \DateTimeInterface|null
*/
public function getDateOfBirth(): ?\DateTimeInterface
{
return $this->dateOfBirth;
}
/**
*
*/
public function getDateOfBirthFormatted(array $options = null): ?string
{
if (empty($this->dateOfBirth)) {
return null;
}
$mode = !empty($_ENV['PARTICIPANTS_DATEOFBIRTH']) ? $_ENV['PARTICIPANTS_DATEOFBIRTH'] : 'Year';
switch ($mode) {
case 'Year':
default:
$formatted = $this->dateOfBirth->format('Y');
break;
case 'Full':
$formatted = $this->dateOfBirth->format('d.m.Y');
break;
}
if (!empty($options['prefix'])) {
$formatted = $options['prefix'] . $formatted;
}
return $formatted;
}
/**
* @param \DateTimeInterface|null $dateOfBirth
* @return Person
*/
public function setDateOfBirth(?\DateTimeInterface $dateOfBirth): self
{
$this->dateOfBirth = $dateOfBirth;
return $this;
}
/**
* @return null|string
*/
public function getCityOfBirth(): ?string
{
return $this->cityOfBirth;
}
/**
* @param string $cityOfBirth
* @return Person
*/
public function setCityOfBirth(?string $cityOfBirth): self
{
$this->cityOfBirth = $cityOfBirth;
return $this;
}
/**
* @return bool|null
*/
public function getIsMainContact(): ?bool
{
return $this->isMainContact;
}
/**
* @param bool|null $isMainContact
* @return Person
*/
public function setIsMainContact(?bool $isMainContact): self
{
$this->isMainContact = $isMainContact;
return $this;
}
/**
* @return bool|null
*/
public function getIsSpeaker(): ?bool
{
return $this->isSpeaker;
}
/**
* @return bool|null
*/
public function isSpeaker(): ?bool
{
return $this->isSpeaker;
}
/**
* @param bool|null $isSpeaker
* @return Person
*/
public function setIsSpeaker(?bool $isSpeaker): self
{
$this->isSpeaker = $isSpeaker;
return $this;
}
/**
* @return bool|null
*/
public function getIsCustomer(): ?bool
{
return $this->isCustomer;
}
/**
* @return bool|null
*/
public function isCustomer(): ?bool
{
return $this->isCustomer;
}
/**
* @param bool|null $isCustomer
* @return Person
*/
public function setIsCustomer(?bool $isCustomer): self
{
$this->isCustomer = $isCustomer;
return $this;
}
/**
* @return null|string
*/
public function getStreet(): ?string
{
return $this->street;
}
/**
* @param null|string $street
* @return Person
*/
public function setStreet(?string $street): self
{
$this->street = $street;
return $this;
}
/**
* @return null|string
*/
public function getStreetNumber(): ?string
{
return $this->streetNumber;
}
/**
* @param null|string $streetNumber
* @return Person
*/
public function setStreetNumber(?string $streetNumber): self
{
$this->streetNumber = $streetNumber;
return $this;
}
/**
* @return null|string
*/
public function getPostalcode(): ?string
{
return $this->postalcode;
}
/**
* @param null|string $postalcode
* @return Person
*/
public function setPostalcode(?string $postalcode): self
{
$this->postalcode = $postalcode;
return $this;
}
/**
* @return null|string
*/
public function getCity(): ?string
{
return $this->city;
}
/**
* @param null|string $city
* @return Person
*/
public function setCity(?string $city): self
{
$this->city = $city;
return $this;
}
/**
* @return null|string
*/
public function getContactEmail(): ?string
{
return $this->contactEmail;
}
/**
* @param null|string $contactEmail
* @return Person
*/
public function setContactEmail(?string $contactEmail): self
{
$this->contactEmail = $contactEmail;
return $this;
}
/**
* @return null|string
*/
public function getWeb(): ?string
{
return $this->web;
}
/**
* @param null|string $web
* @return Person
*/
public function setWeb(?string $web): self
{
$this->web = $web;
return $this;
}
/**
* @return null|string
*/
public function getListname(): ?string
{
return $this->lastname . ', ' . $this->firstname;
}
/**
* @return null|string
*/
public function getFullname(): ?string
{
$name = $this->firstname . ' ' . $this->lastname;
if ($this->member){
$name = $name . ' *';
}
return $this->title ? $this->title . ' ' . $name : $name;
}
/**
* @return null|string
*/
public function getFullnameWithCompany(): ?string
{
$name = $this->firstname . ' ' . $this->lastname;
if ($this->title){
$name = $name . ' ' . $this->title;
}
if ($this->member){
$name = $name . ' *';
}
return $this->company ? $this->company . ' ' . $name : $name;
}
public function getFullnameOrEmail(): ?string
{
$name = '';
if ($this->firstname || $this->lastname) {
$name = $this->firstname . ' ' . $this->lastname;
$name = $this->title ? $this->title . ' ' . $name : $name;
if ($this->member){
$name = $name . ' *';
}
} elseif ($this->getContactEmail()) {
$name = $this->getContactEmail();
} elseif ($this->getUser() && $this->getUser()->getEmail()) {
$name = $this->getUser()->getEmail();
}
return $name;
}
/**
* @return null|string
*/
public function getFullStreet(): ?string
{
return $this->street .
($this->street && $this->streetNumber ? ' ' : '') .
$this->streetNumber;
}
/**
* @return null|string
*/
public function getPostalcodeCity(): ?string
{
return $this->postalcode .
($this->postalcode && $this->city ? ' ' : '') .
$this->city;
}
/**
* @return Client
*/
public function getClient(): ?Client
{
if ($this->getUser()) {
return $this->getUser()->getClient();
} else {
return $this->getFamilyMemberOf()
->getUser()
->getClient();
}
}
/**
* @return null|string
*/
public function getCountry(): ?string
{
return $this->country;
}
/**
* @param null|string $country
* @return Person
*/
public function setCountry(?string $country): self
{
$this->country = $country;
return $this;
}
/**
* @return null|string
*/
public function getPhone(): ?string
{
return $this->phone;
}
/**
* @param null|string $phone
* @return Person
*/
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
/**
* @return null|string
*/
public function getMobile(): ?string
{
return $this->mobile;
}
/**
* @param null|string $mobile
* @return Person
*/
public function setMobile(?string $mobile): self
{
$this->mobile = $mobile;
return $this;
}
/**
* @return \DateTimeInterface|null
*/
public function getDeleteDate(): ?\DateTimeInterface
{
return $this->deleteDate;
}
/**
* @param \DateTimeInterface|null $deleteDate
* @return Person
*/
public function setDeleteDate(?\DateTimeInterface $deleteDate): self
{
$this->deleteDate = $deleteDate;
return $this;
}
/**
* @return null|string
*/
public function getIban(): ?string
{
return $this->iban;
}
/**
* @param null|string $iban
* @return Person
*/
public function setIban(?string $iban): self
{
$this->iban = $iban;
return $this;
}
/**
* @return null|string
*/
public function getBic(): ?string
{
return $this->bic;
}
/**
* @param null|string $bic
* @return Person
*/
public function setBic(?string $bic): self
{
$this->bic = $bic;
return $this;
}
/**
* @return null|string
*/
public function getBank(): ?string
{
return $this->bank;
}
/**
* @param null|string $bank
* @return Person
*/
public function setBank(?string $bank): self
{
$this->bank = $bank;
return $this;
}
/**
* @return bool|null
*/
public function getDebitAgree(): ?bool
{
return $this->debitAgree;
}
/**
* @param bool|null $debitAgree
* @return Person
*/
public function setDebitAgree(?bool $debitAgree): self
{
$this->debitAgree = $debitAgree;
return $this;
}
/**
* @return null|string
*/
public function getDebitAgreeSource(): ?string
{
return $this->debitAgreeSource;
}
/**
* @param string $debitAgreeSource
* @return Person
*/
public function setDebitAgreeSource(string $debitAgreeSource): self
{
$this->debitAgreeSource = $debitAgreeSource;
return $this;
}
/**
* @return \DateTimeInterface|null
*/
public function getDebitAgreeDate(): ?\DateTimeInterface
{
return $this->debitAgreeDate;
}
/**
* @param \DateTimeInterface|null $debitAgreeDate
* @return Person
*/
public function setDebitAgreeDate(?\DateTimeInterface $debitAgreeDate): self
{
$this->debitAgreeDate = $debitAgreeDate;
return $this;
}
/**
* @return bool|null
*/
public function getEmailInvoice(): ?bool
{
return $this->emailInvoice;
}
/**
* @param bool|null $emailInvoice
* @return Person
*/
public function setEmailInvoice(?bool $emailInvoice): self
{
$this->emailInvoice = $emailInvoice;
return $this;
}
/**
* @return Collection|Order[]
*/
public function getOrders(): Collection
{
return $this->orders;
}
/**
* @param Order $order
* @return Person
*/
public function addOrder(Order $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setCustomer($this);
}
return $this;
}
/**
* @param Order $order
* @return Person
*/
public function removeOrder(Order $order): self
{
if ($this->orders->contains($order)) {
$this->orders->removeElement($order);
// set the owning side to null (unless already changed)
if ($order->getCustomer() === $this) {
$order->setCustomer(null);
}
}
return $this;
}
/**
* @return Collection|CourseOccurrence[]
*/
public function getCourses(): Collection
{
return $this->courses;
}
/**
* @param CourseOccurrence $course
* @return Person
*/
public function addCourse(CourseOccurrence $course): self
{
if (!$this->courses->contains($course)) {
$this->courses[] = $course;
}
return $this;
}
/**
* @param CourseOccurrence $course
* @return Person
*/
public function removeCourse(CourseOccurrence $course): self
{
if ($this->courses->contains($course)) {
$this->courses->removeElement($course);
}
return $this;
}
/////////////////////////////////////////////////
/**
* @return Collection|Persontags[]
*/
public function getPersontags(): Collection
{
return $this->persontags;
}
/**
* @param Persontags $persontag
* @return Person
*/
public function addPersontag(TagsPerson $persontag): self
{
if (!$this->persontags->contains($persontag)) {
$this->persontags[] = $persontag;
$persontag->setPerson($this);
}
return $this;
}
/**
* @param Persontags $persontag
* @return Person
*/
public function removePersontag(TagsPerson $persontag): self
{
if (
$this->persontags->removeElement($persontag)
) {
// set the owning side to null (unless already changed)
if ($persontag->getPerson() === $this) {
$persontag->setPerson(null);
}
}
return $this;
}
/////////////////////////////////////////////////
/**
* @return Collection|CustomerHistoryEntry[]
*/
public function getHistory(): Collection
{
return $this->history;
}
/**
* @param CustomerHistoryEntry $history
* @return Person
*/
public function addHistory(CustomerHistoryEntry $history): self
{
if (!$this->history->contains($history)) {
$this->history[] = $history;
$history->setCustomer($this);
}
return $this;
}
/**
* @param CustomerHistoryEntry $history
* @return Person
*/
public function removeHistory(CustomerHistoryEntry $history): self
{
if ($this->history->contains($history)) {
$this->history->removeElement($history);
// set the owning side to null (unless already changed)
if ($history->getCustomer() === $this) {
$history->setCustomer(null);
}
}
return $this;
}
/**
* @return Collection|CustomerDocument[]
*/
public function getDocuments(): Collection
{
return $this->documents;
}
/**
* @param CustomerDocument $document
* @return Person
*/
public function addDocument(CustomerDocument $document): self
{
if (!$this->documents->contains($document)) {
$this->documents[] = $document;
$document->setCustomer($this);
}
return $this;
}
/**
* @param CustomerDocument $document
* @return Person
*/
public function removeDocument(CustomerDocument $document): self
{
if ($this->documents->contains($document)) {
$this->documents->removeElement($document);
// set the owning side to null (unless already changed)
if ($document->getCustomer() === $this) {
$document->setCustomer(null);
}
}
return $this;
}
public function getFamilyMemberOf(): ?self
{
return $this->familyMemberOf;
}
public function setFamilyMemberOf(?self $familyMemberOf): self
{
$this->familyMemberOf = $familyMemberOf;
return $this;
}
public function getSpeaker()
{
return $this->speaker;
}
/**
* @return boolean|null
*/
public function getPrivacyPolicyConfirmed(): ?bool
{
return $this->privacyPolicyConfirmed;
}
/**
* @return boolean|null
*/
public function isPrivacyPolicyConfirmed(): ?bool
{
return $this->getPrivacyPolicyConfirmed();
}
/**
* @param bool $privacyPolicyConfirmed
* @return Person
*/
public function setPrivacyPolicyConfirmed($privacyPolicyConfirmed): self
{
$this->privacyPolicyConfirmed = $privacyPolicyConfirmed;
return $this;
}
/**
* @return boolean|null
*/
public function getReceiveNewsletter(): ?bool
{
return $this->receiveNewsletter;
}
/**
* @return boolean|null
*/
public function isReceiveNewsletter(): ?bool
{
return $this->getReceiveNewsletter();
}
/**
* @param bool $receiveNewsletter
* @return Person
*/
public function setReceiveNewsletter($receiveNewsletter): self
{
$this->receiveNewsletter = $receiveNewsletter;
return $this;
}
/**
* @JMS\Expose
* @JMS\Groups({"family"})
* @JMS\VirtualProperty()
* @JMS\Type("int")
* @return int
*/
public function getId(): ?int
{
return parent::getId();
}
public function getDebitActive(): ?bool
{
return $this->debitActive;
}
public function setDebitActive(?bool $debitActive): self
{
$this->debitActive = $debitActive;
return $this;
}
/**
* @return Collection<int, ManualNewsletter>
*/
public function getManualNewsletter(): Collection
{
return $this->manual_newsletter;
}
public function addManualNewsletter(
ManualNewsletter $manualNewsletter
): self {
if (!$this->manual_newsletter->contains($manualNewsletter)) {
$this->manual_newsletter[] = $manualNewsletter;
$manualNewsletter->setPerson($this);
}
return $this;
}
public function removeManualNewsletter(
ManualNewsletter $manualNewsletter
): self {
if ($this->manual_newsletter->removeElement($manualNewsletter)) {
// set the owning side to null (unless already changed)
if ($manualNewsletter->getPerson() === $this) {
$manualNewsletter->setPerson(null);
}
}
return $this;
}
/**
* @return Collection<int, InvoiceItemAttendees>
*/
public function getInvoiceItemAttendees(): Collection
{
return $this->invoice_item_attendees;
}
public function addInvoiceItemAttendee(
InvoiceItemAttendees $invoiceItemAttendee
): self {
if (!$this->invoice_item_attendees->contains($invoiceItemAttendee)) {
$this->invoice_item_attendees[] = $invoiceItemAttendee;
$invoiceItemAttendee->setPerson($this);
}
return $this;
}
public function removeInvoiceItemAttendee(
InvoiceItemAttendees $invoiceItemAttendee
): self {
if (
$this->invoice_item_attendees->removeElement($invoiceItemAttendee)
) {
// set the owning side to null (unless already changed)
if ($invoiceItemAttendee->getPerson() === $this) {
$invoiceItemAttendee->setPerson(null);
}
}
return $this;
}
public function getIsInvoiceRecipient(): ?bool
{
return $this->isInvoiceRecipient;
}
public function setIsInvoiceRecipient(bool $isInvoiceRecipient): self
{
$this->isInvoiceRecipient = $isInvoiceRecipient;
return $this;
}
public function getCompany(): ?string
{
return $this->company;
}
public function setCompany(?string $company): self
{
$this->company = $company;
return $this;
}
/**
* @return Collection<int, Invoice>
*/
public function getInvoices(): Collection
{
return $this->invoices;
}
public function addInvoice(Invoice $invoice): self
{
if (!$this->invoices->contains($invoice)) {
$this->invoices[] = $invoice;
$invoice->setInvoiceAdressPerson($this);
}
return $this;
}
public function removeInvoice(Invoice $invoice): self
{
if ($this->invoices->removeElement($invoice)) {
// set the owning side to null (unless already changed)
if ($invoice->getInvoiceAdressPerson() === $this) {
$invoice->setInvoiceAdressPerson(null);
}
}
return $this;
}
/**
* @return Collection<int, Order>
*/
public function getNo(): Collection
{
return $this->no;
}
public function addNo(Order $no): self
{
if (!$this->no->contains($no)) {
$this->no[] = $no;
$no->setInvoiceRecipient($this);
}
return $this;
}
public function removeNo(Order $no): self
{
if ($this->no->removeElement($no)) {
// set the owning side to null (unless already changed)
if ($no->getInvoiceRecipient() === $this) {
$no->setInvoiceRecipient(null);
}
}
return $this;
}
/**
* formatFamilyMember
*
* Format the Attributes for FamilyMembers.
* Used in the Frontend.
*
* @return array
*/
public function formatFamilyMember()
{
return [
'id' => $this->id,
'title' => $this->title,
'salutation' => $this->salutation,
'member' => $this->member,
'firstname' => $this->firstname,
'lastname' => $this->lastname,
'contactEmail' => $this->contactEmail,
'dateOfBirth' => $this->dateOfBirth,
'cityOfBirth' => $this->cityOfBirth,
'comment' => $this->comment,
'street' => $this->street,
'streetNumber' => $this->streetNumber,
'postalcode' => $this->postalcode,
'city' => $this->city,
'phone' => $this->phone,
'mobile' => $this->mobile,
'isInvoiceRecipient' => $this->isInvoiceRecipient,
];
}
/**
* @return Collection<int, Presence>
*/
public function getSigner(): Collection
{
return $this->signer;
}
public function addSigner(Presence $signer): self
{
if (!$this->signer->contains($signer)) {
$this->signer[] = $signer;
$signer->setPerson($this);
}
return $this;
}
public function removeSigner(Presence $signer): self
{
if ($this->signer->removeElement($signer)) {
// set the owning side to null (unless already changed)
if ($signer->getPerson() === $this) {
$signer->setPerson(null);
}
}
return $this;
}
}