src/Entity/Person.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Dto\CheckoutDto;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use JMS\Serializer\Annotation as JMS;
  8. use Menke\CommonsBundle\Entity\GenericEntity;
  9. use Menke\UserBundle\Entity\Client;
  10. use Menke\UserBundle\Entity\User;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. /**
  13.  * @ORM\Entity(repositoryClass="App\Repository\PersonRepository")
  14.  * @JMS\ExclusionPolicy("all")
  15.  */
  16. class Person extends GenericEntity
  17. {
  18.     const INVOICE_RECIPIENT 'invoice_recipient';
  19.     /**
  20.      * @ORM\OneToOne(targetEntity="Menke\UserBundle\Entity\User", cascade={"persist", "remove"})
  21.      * @ORM\JoinColumn(nullable=true)
  22.      */
  23.     protected $user;
  24.     /**
  25.      * @ORM\Column(type="string", length=100, nullable=true)
  26.      * @JMS\Expose
  27.      * @JMS\Groups({"family"})
  28.      */
  29.     protected $title;
  30.      /**
  31.      * @ORM\Column(type="string", length=32, nullable=true)
  32.      * @JMS\Expose
  33.      * @JMS\Groups({"family"})
  34.      */
  35.     
  36.      private $salutation;
  37.  /**
  38.      * @ORM\Column(type="string", length=255, nullable=true)
  39.      * @JMS\Expose
  40.      * @JMS\Groups({"family"})
  41.      */
  42.     private $member;
  43.     /**
  44.      * @ORM\Column(type="string", length=255, nullable=true)
  45.      * @JMS\Expose
  46.      * @JMS\Groups({"family"})
  47.      */
  48.     
  49.     protected $firstname;
  50.     /**
  51.      * @ORM\Column(type="string", length=255, nullable=true)
  52.      * @JMS\Expose
  53.      * @JMS\Groups({"family"})
  54.      */
  55.     protected $lastname;
  56.     /**
  57.      * @ORM\Column(type="date", nullable=true)
  58.      * @JMS\Expose
  59.      * @JMS\Groups({"family"})
  60.      */
  61.     protected $dateOfBirth;
  62.     /**
  63.      * @ORM\Column(type="string", length=128,  nullable=true)
  64.      * @JMS\Expose
  65.      * @JMS\Groups({"family"})
  66.      */
  67.     protected $cityOfBirth;
  68.     
  69.     /**
  70.      * @ORM\Column(type="text", nullable=true)
  71.      * @JMS\Expose
  72.      * @JMS\Groups({"family"})
  73.      */
  74.     protected $comment;
  75.     /**
  76.      * @ORM\Column(type="boolean", nullable=true)
  77.      */
  78.     protected $isMainContact;
  79.     /**
  80.      * @ORM\Column(type="boolean", nullable=true)
  81.      */
  82.     protected $isSpeaker false;
  83.     /**
  84.      * @ORM\Column(type="boolean", nullable=true)
  85.      */
  86.     protected $isCustomer false;
  87.     /**
  88.      * @ORM\Column(type="string", length=255, nullable=true)
  89.      */
  90.     protected $street;
  91.     /**
  92.      * @ORM\Column(type="string", length=10, nullable=true)
  93.      */
  94.     protected $streetNumber;
  95.     /**
  96.      * @ORM\Column(type="string", length=10, nullable=true)
  97.      */
  98.     protected $postalcode;
  99.     /**
  100.      * @ORM\Column(type="string", length=255, nullable=true)
  101.      * @JMS\Expose
  102.      * @JMS\Groups({"family"})
  103.      */
  104.     protected $city;
  105.     /**
  106.      * @ORM\Column(type="string", length=255, nullable=true)
  107.      */
  108.     protected $contactEmail;
  109.     /**
  110.      * @ORM\Column(type="string", length=255, nullable=true)
  111.      */
  112.     protected $web;
  113.     /**
  114.      * @ORM\Column(type="string", length=10, nullable=true)
  115.      */
  116.     protected $country;
  117.     /**
  118.      * @ORM\Column(type="string", length=30, nullable=true)
  119.      */
  120.     protected $phone;
  121.     /**
  122.      * @ORM\Column(type="string", length=30, nullable=true)
  123.      */
  124.     protected $mobile;
  125.     /**
  126.      * @ORM\Column(type="datetime", nullable=true)
  127.      */
  128.     protected $deleteDate;
  129.     /**
  130.      * @var string
  131.      * @ORM\Column(type="string", length=30, nullable=true)
  132.      * @Assert\Iban(
  133.      *     message="Kein legales IBAN format."
  134.      * )
  135.      */
  136.     protected $iban;
  137.     /**
  138.      * @ORM\Column(type="string", length=20, nullable=true)
  139.      */
  140.     protected $bic;
  141.     /**
  142.      * @ORM\Column(type="string", length=255, nullable=true)
  143.      */
  144.     protected $bank;
  145.     /**
  146.      * @ORM\Column(type="boolean", nullable=true)
  147.      */
  148.     protected $debitAgree;
  149.     /**
  150.      * @ORM\Column(type="string", length=50, nullable=true)
  151.      */
  152.     protected $debitAgreeSource;
  153.     /**
  154.      * @ORM\Column(type="datetime", nullable=true)
  155.      */
  156.     protected $debitAgreeDate;
  157.     /**
  158.      * @ORM\Column(type="boolean", nullable=true)
  159.      */
  160.     protected $emailInvoice;
  161.     /**
  162.      * @ORM\OneToMany(targetEntity="App\Entity\Order", mappedBy="customer")
  163.      */
  164.     protected $orders;
  165.     /**
  166.      * @ORM\ManyToMany(targetEntity="App\Entity\CourseOccurrence", inversedBy="customers")
  167.      */
  168.     protected $courses;
  169.     /**
  170.      * @ORM\OneToMany(targetEntity="App\Entity\CustomerHistoryEntry", mappedBy="customer", orphanRemoval=true, cascade={"all"})
  171.      */
  172.     protected $history;
  173.     /**
  174.      * @ORM\OneToMany(targetEntity="App\Entity\CustomerDocument", mappedBy="customer", orphanRemoval=true, cascade={"all"})
  175.      */
  176.     protected $documents;
  177.     /**
  178.      * @ORM\ManyToOne(targetEntity="App\Entity\Person", cascade={"all"})
  179.      */
  180.     protected $familyMemberOf;
  181.     /**
  182.      * @ORM\OneToOne(targetEntity="App\Entity\Speaker", mappedBy="person")
  183.      */
  184.     protected $speaker;
  185.     /**
  186.      * @ORM\Column(type="boolean")
  187.      */
  188.     protected $privacyPolicyConfirmed false;
  189.     /**
  190.      * @ORM\Column(type="boolean")
  191.      */
  192.     protected $receiveNewsletter false;
  193.     /**
  194.      * @ORM\Column(type="boolean", nullable=true)
  195.      */
  196.     protected $debitActive 0;
  197.     /**
  198.      * @ORM\OneToMany(targetEntity=ManualNewsletter::class, mappedBy="person")
  199.      */
  200.     private $manual_newsletter;
  201.     /**
  202.      * @ORM\OneToMany(targetEntity=InvoiceItemAttendees::class, mappedBy="person")
  203.      */
  204.     private $invoice_item_attendees;
  205.     /**
  206.      * @ORM\Column(type="boolean")
  207.      */
  208.     private $isInvoiceRecipient 0;
  209.     /**
  210.      * @ORM\OneToMany(targetEntity=Invoice::class, mappedBy="invoiceAdressPerson")
  211.      */
  212.     private $invoices;
  213.     /**
  214.      * @ORM\OneToMany(targetEntity=Order::class, mappedBy="invoiceRecipient")
  215.      */
  216.     private $no;
  217.     /**
  218.      * @ORM\Column(type="string", length=255, nullable=true)
  219.      */
  220.     private $company;
  221.     /**
  222.      * @ORM\OneToMany(targetEntity=TagsPerson::class, mappedBy="person", orphanRemoval=true)
  223.      */
  224.     private $persontags;
  225.     
  226.     public function __toString() {
  227.         return $this->lastname;
  228.     }
  229.     public function __construct()
  230.     {
  231.         $this->orders = new ArrayCollection();
  232.         $this->courses = new ArrayCollection();
  233.         $this->history = new ArrayCollection();
  234.         $this->persontags = new ArrayCollection();
  235.         $this->documents = new ArrayCollection();
  236.         $this->manual_newsletter = new ArrayCollection();
  237.         $this->invoice_item_attendees = new ArrayCollection();
  238.         $this->invoices = new ArrayCollection();
  239.         $this->no = new ArrayCollection();
  240.         $this->signer = new ArrayCollection();
  241.        
  242.     }
  243.     /**
  244.      * @param CheckoutDto $checkout
  245.      *
  246.      * @return Person
  247.      */
  248.     public static function createFromCheckout(CheckoutDto $checkout)
  249.     {
  250.         $now date("d.m.Y");
  251.         $entity = new self();
  252.         $entity->title $checkout->customerTitle;
  253.         $entity->salutation $checkout->customerSalutation;
  254.         $entity->member $checkout->customerMember;
  255.         $entity->company $checkout->customerCompany;
  256.         $entity->firstname $checkout->customerFirstname;
  257.         $entity->lastname $checkout->customerLastname;
  258.         if(!empty($checkout->customerComment)){
  259.         $entity->comment $now " : " $checkout->customerComment '<br>';}
  260.         else{
  261.             $entity->comment '';
  262.         }
  263.         $entity->street $checkout->customerStreet;
  264.         $entity->streetNumber $checkout->customerStreetNumber;
  265.         $entity->postalcode $checkout->customerPostalcode;
  266.         $entity->city $checkout->customerCity;
  267.         $entity->contactEmail $checkout->customerContactEmail;
  268.         $entity->phone $checkout->customerPhone;
  269.         $entity->country $checkout->customerCountry;
  270.         $entity->bic $checkout->bic;
  271.         $entity->iban $checkout->iban;
  272.         $entity->bank $checkout->bank;
  273.         
  274.     $entity->setCreated(new \datetime());
  275.         return $entity;
  276.     }
  277.     public function updateFromCheckout(CheckoutDto $checkout)
  278.     {
  279.         $now date("d.m.Y");
  280.         $newComment '';
  281.         if (empty($checkout->customerComment)) {
  282.             $newComment $this->comment;
  283.         } else {
  284.             $newComment $now ': ' $checkout->customerComment '<br>' .  $this->comment;
  285.         }
  286.         $this->title $checkout->customerTitle;
  287.         $this->salutation $checkout->customerSalutation;
  288.         $this->member $checkout->customerMember;
  289.         $this->company $checkout->customerCompany;
  290.         $this->firstname $checkout->customerFirstname;
  291.         $this->lastname $checkout->customerLastname;
  292.         $this->comment $newComment;
  293.         $this->street $checkout->customerStreet;
  294.         $this->streetNumber $checkout->customerStreetNumber;
  295.         $this->postalcode $checkout->customerPostalcode;
  296.         $this->city $checkout->customerCity;
  297.         $this->contactEmail $checkout->customerContactEmail;
  298.         $this->phone $checkout->customerPhone;
  299.         $this->country $checkout->customerCountry;
  300.         $this->bic $checkout->bic;
  301.         $this->iban $checkout->iban;
  302.         $this->bank $checkout->bank;
  303.         $this->setModified(new \datetime());
  304.     }
  305.     /**
  306.      * updateOrderAddresses
  307.      *
  308.      * Updated the addresses of the orders. Only if they're on 'pending' or 'processing'
  309.      * 
  310.      * @return array $res
  311.      */
  312.     public function updateOrderAddresses()
  313.     {
  314.         $res = [];
  315.         foreach ($this->getOrders() as $order) {
  316.             if ($order->getStatus() == 'pending' || $order->getStatus() == 'processing') {
  317.                 $order->setCustomerCompany($this->company);
  318.                 $order->setCustomerTitle($this->title);
  319.                 $order->setCustomerSalutation($this->salutation);
  320.                // sollen auch alle Orders die Mitgliedschaft aktualisieren? 
  321.                // $order->setCustomerMember($this->member);
  322.                 $order->setCustomerFirstname($this->firstname);
  323.                 $order->setCustomerLastname($this->lastname);
  324.                 $order->setCustomerStreet($this->street);
  325.                 $order->setCustomerStreetNumber($this->streetNumber);
  326.                 $order->setCustomerPostalcode($this->postalcode);
  327.                 $order->setCustomerCity($this->city);
  328.                 $order->setCustomerContactEmail($this->contactEmail);
  329.                 $order->setCustomerPhone($this->phone);
  330.                 $order->setCustomerCountry($this->country);
  331.                 $order->setModified(new \datetime());
  332.                 $res[] = $order;
  333.             }
  334.         }
  335.         return $res;
  336.     }
  337.     /**
  338.      * @return User
  339.      */
  340.     public function getUser(): ?User
  341.     {
  342.         return $this->user;
  343.     }
  344.     /**
  345.      * @param User $user
  346.      * @return Person
  347.      */
  348.     public function setUser($user): self
  349.     {
  350.         $this->user $user;
  351.         return $this;
  352.     }
  353.     /**
  354.      * @return null|string
  355.      */
  356.     public function getTitle(): ?string
  357.     {
  358.         return $this->title;
  359.     }
  360.     /**
  361.      * @param null|string $title
  362.      * @return Person
  363.      */
  364.     public function setTitle(?string $title): self
  365.     {
  366.         $this->title $title;
  367.         return $this;
  368.     }
  369.      /**
  370.      * @return null|string
  371.      */
  372.     public function getSalutation(): ?string
  373.     {
  374.         return $this->salutation;
  375.     }
  376.     /**
  377.      * @param null|string $salutation
  378.      * @return Person
  379.      */
  380.     public function setSalutation(?string $salutation): self
  381.     {
  382.         $this->salutation $salutation;
  383.         return $this;
  384.     }
  385.  /**
  386.      * @return null|string
  387.      */
  388.     public function getMember(): ?string
  389.     {
  390.         return $this->member;
  391.     }
  392.     /**
  393.      * @param null|string $member
  394.      * @return Person
  395.      */
  396.     public function setMember(?string $member): self
  397.     {
  398.         $this->member $member;
  399.         return $this;
  400.     }
  401.     /**
  402.      * @return null|string
  403.      */
  404.     public function getFirstname(): ?string
  405.     {
  406.         return $this->firstname;
  407.     }
  408.     /**
  409.      * @param string $firstname
  410.      * @return Person
  411.      */
  412.     public function setFirstname(?string $firstname): self
  413.     {
  414.         $this->firstname $firstname;
  415.         return $this;
  416.     }
  417.     /**
  418.      * @return null|string
  419.      */
  420.     public function getLastname(): ?string
  421.     {
  422.         return $this->lastname;
  423.     }
  424.     /**
  425.      * @param string $lastname
  426.      * @return Person
  427.      */
  428.     public function setLastname(?string $lastname): self
  429.     {
  430.         $this->lastname $lastname;
  431.         return $this;
  432.     }
  433.     /**
  434.      * @return null|string
  435.      */
  436.     public function getComment(): ?string
  437.     {
  438.         return $this->comment;
  439.     }
  440.     /**
  441.      * @param string $comment
  442.      * @return Person
  443.      */
  444.     public function setComment(?string $comment): self
  445.     {
  446.         $this->comment $comment;
  447.         return $this;
  448.     }
  449.     /**
  450.      * @return \DateTimeInterface|null
  451.      */
  452.     public function getDateOfBirth(): ?\DateTimeInterface
  453.     {
  454.         return $this->dateOfBirth;
  455.     }
  456.     /**
  457.      *
  458.      */
  459.     public function getDateOfBirthFormatted(array $options null): ?string
  460.     {
  461.         if (empty($this->dateOfBirth)) {
  462.             return null;
  463.         }
  464.         $mode = !empty($_ENV['PARTICIPANTS_DATEOFBIRTH']) ? $_ENV['PARTICIPANTS_DATEOFBIRTH'] : 'Year';
  465.         
  466.         switch ($mode) {
  467.             case 'Year':
  468.             default:
  469.                 $formatted $this->dateOfBirth->format('Y');
  470.                 break;
  471.             case 'Full':
  472.                 $formatted $this->dateOfBirth->format('d.m.Y');
  473.                 break;
  474.         }
  475.         if (!empty($options['prefix'])) {
  476.             $formatted $options['prefix'] . $formatted;
  477.         }
  478.         return $formatted;
  479.     }
  480.     /**
  481.      * @param \DateTimeInterface|null $dateOfBirth
  482.      * @return Person
  483.      */
  484.     public function setDateOfBirth(?\DateTimeInterface $dateOfBirth): self
  485.     {
  486.         $this->dateOfBirth $dateOfBirth;
  487.         return $this;
  488.     }
  489.         /**
  490.      * @return null|string
  491.      */
  492.     public function getCityOfBirth(): ?string
  493.     {
  494.         return $this->cityOfBirth;
  495.     }
  496.     /**
  497.      * @param string $cityOfBirth
  498.      * @return Person
  499.      */
  500.     public function setCityOfBirth(?string $cityOfBirth): self
  501.     {
  502.         $this->cityOfBirth $cityOfBirth;
  503.         return $this;
  504.     }
  505.     /**
  506.      * @return bool|null
  507.      */
  508.     public function getIsMainContact(): ?bool
  509.     {
  510.         return $this->isMainContact;
  511.     }
  512.     /**
  513.      * @param bool|null $isMainContact
  514.      * @return Person
  515.      */
  516.     public function setIsMainContact(?bool $isMainContact): self
  517.     {
  518.         $this->isMainContact $isMainContact;
  519.         return $this;
  520.     }
  521.     /**
  522.      * @return bool|null
  523.      */
  524.     public function getIsSpeaker(): ?bool
  525.     {
  526.         return $this->isSpeaker;
  527.     }
  528.     /**
  529.      * @return bool|null
  530.      */
  531.     public function isSpeaker(): ?bool
  532.     {
  533.         return $this->isSpeaker;
  534.     }
  535.     /**
  536.      * @param bool|null $isSpeaker
  537.      * @return Person
  538.      */
  539.     public function setIsSpeaker(?bool $isSpeaker): self
  540.     {
  541.         $this->isSpeaker $isSpeaker;
  542.         return $this;
  543.     }
  544.     /**
  545.      * @return bool|null
  546.      */
  547.     public function getIsCustomer(): ?bool
  548.     {
  549.         return $this->isCustomer;
  550.     }
  551.     /**
  552.      * @return bool|null
  553.      */
  554.     public function isCustomer(): ?bool
  555.     {
  556.         return $this->isCustomer;
  557.     }
  558.     /**
  559.      * @param bool|null $isCustomer
  560.      * @return Person
  561.      */
  562.     public function setIsCustomer(?bool $isCustomer): self
  563.     {
  564.         $this->isCustomer $isCustomer;
  565.         return $this;
  566.     }
  567.     /**
  568.      * @return null|string
  569.      */
  570.     public function getStreet(): ?string
  571.     {
  572.         return $this->street;
  573.     }
  574.     /**
  575.      * @param null|string $street
  576.      * @return Person
  577.      */
  578.     public function setStreet(?string $street): self
  579.     {
  580.         $this->street $street;
  581.         return $this;
  582.     }
  583.     /**
  584.      * @return null|string
  585.      */
  586.     public function getStreetNumber(): ?string
  587.     {
  588.         return $this->streetNumber;
  589.     }
  590.     /**
  591.      * @param null|string $streetNumber
  592.      * @return Person
  593.      */
  594.     public function setStreetNumber(?string $streetNumber): self
  595.     {
  596.         $this->streetNumber $streetNumber;
  597.         return $this;
  598.     }
  599.     /**
  600.      * @return null|string
  601.      */
  602.     public function getPostalcode(): ?string
  603.     {
  604.         return $this->postalcode;
  605.     }
  606.     /**
  607.      * @param null|string $postalcode
  608.      * @return Person
  609.      */
  610.     public function setPostalcode(?string $postalcode): self
  611.     {
  612.         $this->postalcode $postalcode;
  613.         return $this;
  614.     }
  615.     /**
  616.      * @return null|string
  617.      */
  618.     public function getCity(): ?string
  619.     {
  620.         return $this->city;
  621.     }
  622.     /**
  623.      * @param null|string $city
  624.      * @return Person
  625.      */
  626.     public function setCity(?string $city): self
  627.     {
  628.         $this->city $city;
  629.         return $this;
  630.     }
  631.     /**
  632.      * @return null|string
  633.      */
  634.     public function getContactEmail(): ?string
  635.     {
  636.         return $this->contactEmail;
  637.     }
  638.     /**
  639.      * @param null|string $contactEmail
  640.      * @return Person
  641.      */
  642.     public function setContactEmail(?string $contactEmail): self
  643.     {
  644.         $this->contactEmail $contactEmail;
  645.         return $this;
  646.     }
  647.     /**
  648.      * @return null|string
  649.      */
  650.     public function getWeb(): ?string
  651.     {
  652.         return $this->web;
  653.     }
  654.     /**
  655.      * @param null|string $web
  656.      * @return Person
  657.      */
  658.     public function setWeb(?string $web): self
  659.     {
  660.         $this->web $web;
  661.         return $this;
  662.     }
  663.     /**
  664.      * @return null|string
  665.      */
  666.     public function getListname(): ?string
  667.     {
  668.         return $this->lastname ', ' $this->firstname;
  669.     }
  670.     /**
  671.      * @return null|string
  672.      */
  673.     public function getFullname(): ?string
  674.     {
  675.         $name $this->firstname ' ' $this->lastname;
  676.         if ($this->member){
  677.             $name $name ' *';
  678.         }
  679.         return $this->title $this->title ' ' $name $name;
  680.     }
  681.     /**
  682.      * @return null|string
  683.      */
  684.     public function getFullnameWithCompany(): ?string
  685.     {
  686.         $name $this->firstname ' ' $this->lastname;
  687.        if ($this->title){
  688.             $name $name ' ' $this->title;
  689.         }
  690.         if ($this->member){
  691.             $name $name ' *';
  692.         }      
  693.         return $this->company $this->company ' ' $name $name;
  694.     }
  695.     public function getFullnameOrEmail(): ?string
  696.     {
  697.         $name '';
  698.         if ($this->firstname || $this->lastname) {
  699.             $name $this->firstname ' ' $this->lastname;
  700.             $name $this->title $this->title ' ' $name $name;
  701.             if ($this->member){
  702.                 $name $name ' *';
  703.             }
  704.         } elseif ($this->getContactEmail()) {
  705.             $name $this->getContactEmail();
  706.         } elseif ($this->getUser() && $this->getUser()->getEmail()) {
  707.             $name $this->getUser()->getEmail();
  708.         }
  709.         return $name;
  710.     }
  711.     /**
  712.      * @return null|string
  713.      */
  714.     public function getFullStreet(): ?string
  715.     {
  716.         return $this->street .
  717.             ($this->street && $this->streetNumber ' ' '') .
  718.             $this->streetNumber;
  719.     }
  720.     /**
  721.      * @return null|string
  722.      */
  723.     public function getPostalcodeCity(): ?string
  724.     {
  725.         return $this->postalcode .
  726.             ($this->postalcode && $this->city ' ' '') .
  727.             $this->city;
  728.     }
  729.     /**
  730.      * @return Client
  731.      */
  732.     public function getClient(): ?Client
  733.     {
  734.         if ($this->getUser()) {
  735.             return $this->getUser()->getClient();
  736.         } else {
  737.             return $this->getFamilyMemberOf()
  738.                 ->getUser()
  739.                 ->getClient();
  740.         }
  741.     }
  742.     /**
  743.      * @return null|string
  744.      */
  745.     public function getCountry(): ?string
  746.     {
  747.         return $this->country;
  748.     }
  749.     /**
  750.      * @param null|string $country
  751.      * @return Person
  752.      */
  753.     public function setCountry(?string $country): self
  754.     {
  755.         $this->country $country;
  756.         return $this;
  757.     }
  758.     /**
  759.      * @return null|string
  760.      */
  761.     public function getPhone(): ?string
  762.     {
  763.         return $this->phone;
  764.     }
  765.     /**
  766.      * @param null|string $phone
  767.      * @return Person
  768.      */
  769.     public function setPhone(?string $phone): self
  770.     {
  771.         $this->phone $phone;
  772.         return $this;
  773.     }
  774.     /**
  775.      * @return null|string
  776.      */
  777.     public function getMobile(): ?string
  778.     {
  779.         return $this->mobile;
  780.     }
  781.     /**
  782.      * @param null|string $mobile
  783.      * @return Person
  784.      */
  785.     public function setMobile(?string $mobile): self
  786.     {
  787.         $this->mobile $mobile;
  788.         return $this;
  789.     }
  790.     /**
  791.      * @return \DateTimeInterface|null
  792.      */
  793.     public function getDeleteDate(): ?\DateTimeInterface
  794.     {
  795.         return $this->deleteDate;
  796.     }
  797.     /**
  798.      * @param \DateTimeInterface|null $deleteDate
  799.      * @return Person
  800.      */
  801.     public function setDeleteDate(?\DateTimeInterface $deleteDate): self
  802.     {
  803.         $this->deleteDate $deleteDate;
  804.         return $this;
  805.     }
  806.     /**
  807.      * @return null|string
  808.      */
  809.     public function getIban(): ?string
  810.     {
  811.         return $this->iban;
  812.     }
  813.     /**
  814.      * @param null|string $iban
  815.      * @return Person
  816.      */
  817.     public function setIban(?string $iban): self
  818.     {
  819.         $this->iban $iban;
  820.         return $this;
  821.     }
  822.     /**
  823.      * @return null|string
  824.      */
  825.     public function getBic(): ?string
  826.     {
  827.         return $this->bic;
  828.     }
  829.     /**
  830.      * @param null|string $bic
  831.      * @return Person
  832.      */
  833.     public function setBic(?string $bic): self
  834.     {
  835.         $this->bic $bic;
  836.         return $this;
  837.     }
  838.     /**
  839.      * @return null|string
  840.      */
  841.     public function getBank(): ?string
  842.     {
  843.         return $this->bank;
  844.     }
  845.     /**
  846.      * @param null|string $bank
  847.      * @return Person
  848.      */
  849.     public function setBank(?string $bank): self
  850.     {
  851.         $this->bank $bank;
  852.         return $this;
  853.     }
  854.     /**
  855.      * @return bool|null
  856.      */
  857.     public function getDebitAgree(): ?bool
  858.     {
  859.         return $this->debitAgree;
  860.     }
  861.     /**
  862.      * @param bool|null $debitAgree
  863.      * @return Person
  864.      */
  865.     public function setDebitAgree(?bool $debitAgree): self
  866.     {
  867.         $this->debitAgree $debitAgree;
  868.         return $this;
  869.     }
  870.     /**
  871.      * @return null|string
  872.      */
  873.     public function getDebitAgreeSource(): ?string
  874.     {
  875.         return $this->debitAgreeSource;
  876.     }
  877.     /**
  878.      * @param string $debitAgreeSource
  879.      * @return Person
  880.      */
  881.     public function setDebitAgreeSource(string $debitAgreeSource): self
  882.     {
  883.         $this->debitAgreeSource $debitAgreeSource;
  884.         return $this;
  885.     }
  886.     /**
  887.      * @return \DateTimeInterface|null
  888.      */
  889.     public function getDebitAgreeDate(): ?\DateTimeInterface
  890.     {
  891.         return $this->debitAgreeDate;
  892.     }
  893.     /**
  894.      * @param \DateTimeInterface|null $debitAgreeDate
  895.      * @return Person
  896.      */
  897.     public function setDebitAgreeDate(?\DateTimeInterface $debitAgreeDate): self
  898.     {
  899.         $this->debitAgreeDate $debitAgreeDate;
  900.         return $this;
  901.     }
  902.     /**
  903.      * @return bool|null
  904.      */
  905.     public function getEmailInvoice(): ?bool
  906.     {
  907.         return $this->emailInvoice;
  908.     }
  909.     /**
  910.      * @param bool|null $emailInvoice
  911.      * @return Person
  912.      */
  913.     public function setEmailInvoice(?bool $emailInvoice): self
  914.     {
  915.         $this->emailInvoice $emailInvoice;
  916.         return $this;
  917.     }
  918.     /**
  919.      * @return Collection|Order[]
  920.      */
  921.     public function getOrders(): Collection
  922.     {
  923.         return $this->orders;
  924.     }
  925.     /**
  926.      * @param Order $order
  927.      * @return Person
  928.      */
  929.     public function addOrder(Order $order): self
  930.     {
  931.         if (!$this->orders->contains($order)) {
  932.             $this->orders[] = $order;
  933.             $order->setCustomer($this);
  934.         }
  935.         return $this;
  936.     }
  937.     /**
  938.      * @param Order $order
  939.      * @return Person
  940.      */
  941.     public function removeOrder(Order $order): self
  942.     {
  943.         if ($this->orders->contains($order)) {
  944.             $this->orders->removeElement($order);
  945.             // set the owning side to null (unless already changed)
  946.             if ($order->getCustomer() === $this) {
  947.                 $order->setCustomer(null);
  948.             }
  949.         }
  950.         return $this;
  951.     }
  952.         /**
  953.      * @return Collection|CourseOccurrence[]
  954.      */
  955.     public function getCourses(): Collection
  956.     {
  957.         return $this->courses;
  958.     }
  959.     /**
  960.      * @param CourseOccurrence $course
  961.      * @return Person
  962.      */
  963.     public function addCourse(CourseOccurrence $course): self
  964.     {
  965.         if (!$this->courses->contains($course)) {
  966.             $this->courses[] = $course;
  967.         }
  968.         return $this;
  969.     }
  970.     /**
  971.      * @param CourseOccurrence $course
  972.      * @return Person
  973.      */
  974.     public function removeCourse(CourseOccurrence $course): self
  975.     {
  976.         if ($this->courses->contains($course)) {
  977.             $this->courses->removeElement($course);
  978.         }
  979.         return $this;
  980.     }
  981. /////////////////////////////////////////////////
  982.   /**
  983.      * @return Collection|Persontags[]
  984.      */
  985.     public function getPersontags(): Collection
  986.     {
  987.         return $this->persontags;
  988.     }
  989.     /**
  990.      * @param Persontags $persontag
  991.      * @return Person
  992.      */
  993.     public function addPersontag(TagsPerson $persontag): self 
  994.     {
  995.         if (!$this->persontags->contains($persontag)) {
  996.             $this->persontags[] = $persontag;
  997.             $persontag->setPerson($this);
  998.         }
  999.         return $this;
  1000.     }
  1001.     /**
  1002.      * @param Persontags $persontag
  1003.      * @return Person
  1004.      */
  1005.     public function removePersontag(TagsPerson $persontag): self 
  1006.         {
  1007.         if (
  1008.             $this->persontags->removeElement($persontag)
  1009.         ) {
  1010.             // set the owning side to null (unless already changed)
  1011.             if ($persontag->getPerson() === $this) {
  1012.                 $persontag->setPerson(null);
  1013.             }
  1014.         }
  1015.         return $this;
  1016.     }
  1017. /////////////////////////////////////////////////
  1018.     /**
  1019.      * @return Collection|CustomerHistoryEntry[]
  1020.      */
  1021.     public function getHistory(): Collection
  1022.     {
  1023.         return $this->history;
  1024.     }
  1025.     /**
  1026.      * @param CustomerHistoryEntry $history
  1027.      * @return Person
  1028.      */
  1029.     public function addHistory(CustomerHistoryEntry $history): self
  1030.     {
  1031.         if (!$this->history->contains($history)) {
  1032.             $this->history[] = $history;
  1033.             $history->setCustomer($this);
  1034.         }
  1035.         return $this;
  1036.     }
  1037.     /**
  1038.      * @param CustomerHistoryEntry $history
  1039.      * @return Person
  1040.      */
  1041.     public function removeHistory(CustomerHistoryEntry $history): self
  1042.     {
  1043.         if ($this->history->contains($history)) {
  1044.             $this->history->removeElement($history);
  1045.             // set the owning side to null (unless already changed)
  1046.             if ($history->getCustomer() === $this) {
  1047.                 $history->setCustomer(null);
  1048.             }
  1049.         }
  1050.         return $this;
  1051.     }
  1052.     /**
  1053.      * @return Collection|CustomerDocument[]
  1054.      */
  1055.     public function getDocuments(): Collection
  1056.     {
  1057.         return $this->documents;
  1058.     }
  1059.     /**
  1060.      * @param CustomerDocument $document
  1061.      * @return Person
  1062.      */
  1063.     public function addDocument(CustomerDocument $document): self
  1064.     {
  1065.         if (!$this->documents->contains($document)) {
  1066.             $this->documents[] = $document;
  1067.             $document->setCustomer($this);
  1068.         }
  1069.         return $this;
  1070.     }
  1071.     /**
  1072.      * @param CustomerDocument $document
  1073.      * @return Person
  1074.      */
  1075.     public function removeDocument(CustomerDocument $document): self
  1076.     {
  1077.         if ($this->documents->contains($document)) {
  1078.             $this->documents->removeElement($document);
  1079.             // set the owning side to null (unless already changed)
  1080.             if ($document->getCustomer() === $this) {
  1081.                 $document->setCustomer(null);
  1082.             }
  1083.         }
  1084.         return $this;
  1085.     }
  1086.     public function getFamilyMemberOf(): ?self
  1087.     {
  1088.         return $this->familyMemberOf;
  1089.     }
  1090.     public function setFamilyMemberOf(?self $familyMemberOf): self
  1091.     {
  1092.         $this->familyMemberOf $familyMemberOf;
  1093.         return $this;
  1094.     }
  1095.     public function getSpeaker()
  1096.     {
  1097.         return $this->speaker;
  1098.     }
  1099.     /**
  1100.      * @return boolean|null
  1101.      */
  1102.     public function getPrivacyPolicyConfirmed(): ?bool
  1103.     {
  1104.         return $this->privacyPolicyConfirmed;
  1105.     }
  1106.     /**
  1107.      * @return boolean|null
  1108.      */
  1109.     public function isPrivacyPolicyConfirmed(): ?bool
  1110.     {
  1111.         return $this->getPrivacyPolicyConfirmed();
  1112.     }
  1113.     /**
  1114.      * @param bool $privacyPolicyConfirmed
  1115.      * @return Person
  1116.      */
  1117.     public function setPrivacyPolicyConfirmed($privacyPolicyConfirmed): self
  1118.     {
  1119.         $this->privacyPolicyConfirmed $privacyPolicyConfirmed;
  1120.         return $this;
  1121.     }
  1122.     /**
  1123.      * @return boolean|null
  1124.      */
  1125.     public function getReceiveNewsletter(): ?bool
  1126.     {
  1127.         return $this->receiveNewsletter;
  1128.     }
  1129.     /**
  1130.      * @return boolean|null
  1131.      */
  1132.     public function isReceiveNewsletter(): ?bool
  1133.     {
  1134.         return $this->getReceiveNewsletter();
  1135.     }
  1136.     /**
  1137.      * @param bool $receiveNewsletter
  1138.      * @return Person
  1139.      */
  1140.     public function setReceiveNewsletter($receiveNewsletter): self
  1141.     {
  1142.         $this->receiveNewsletter $receiveNewsletter;
  1143.         return $this;
  1144.     }
  1145.     /**
  1146.      * @JMS\Expose
  1147.      * @JMS\Groups({"family"})
  1148.      * @JMS\VirtualProperty()
  1149.      * @JMS\Type("int")
  1150.      * @return int
  1151.      */
  1152.     public function getId(): ?int
  1153.     {
  1154.         return parent::getId();
  1155.     }
  1156.     public function getDebitActive(): ?bool
  1157.     {
  1158.         return $this->debitActive;
  1159.     }
  1160.     public function setDebitActive(?bool $debitActive): self
  1161.     {
  1162.         $this->debitActive $debitActive;
  1163.         return $this;
  1164.     }
  1165.     /**
  1166.      * @return Collection<int, ManualNewsletter>
  1167.      */
  1168.     public function getManualNewsletter(): Collection
  1169.     {
  1170.         return $this->manual_newsletter;
  1171.     }
  1172.     public function addManualNewsletter(
  1173.         ManualNewsletter $manualNewsletter
  1174.     ): self {
  1175.         if (!$this->manual_newsletter->contains($manualNewsletter)) {
  1176.             $this->manual_newsletter[] = $manualNewsletter;
  1177.             $manualNewsletter->setPerson($this);
  1178.         }
  1179.         return $this;
  1180.     }
  1181.     public function removeManualNewsletter(
  1182.         ManualNewsletter $manualNewsletter
  1183.     ): self {
  1184.         if ($this->manual_newsletter->removeElement($manualNewsletter)) {
  1185.             // set the owning side to null (unless already changed)
  1186.             if ($manualNewsletter->getPerson() === $this) {
  1187.                 $manualNewsletter->setPerson(null);
  1188.             }
  1189.         }
  1190.         return $this;
  1191.     }
  1192.     /**
  1193.      * @return Collection<int, InvoiceItemAttendees>
  1194.      */
  1195.     public function getInvoiceItemAttendees(): Collection
  1196.     {
  1197.         return $this->invoice_item_attendees;
  1198.     }
  1199.     public function addInvoiceItemAttendee(
  1200.         InvoiceItemAttendees $invoiceItemAttendee
  1201.     ): self {
  1202.         if (!$this->invoice_item_attendees->contains($invoiceItemAttendee)) {
  1203.             $this->invoice_item_attendees[] = $invoiceItemAttendee;
  1204.             $invoiceItemAttendee->setPerson($this);
  1205.         }
  1206.         return $this;
  1207.     }
  1208.     public function removeInvoiceItemAttendee(
  1209.         InvoiceItemAttendees $invoiceItemAttendee
  1210.     ): self {
  1211.         if (
  1212.             $this->invoice_item_attendees->removeElement($invoiceItemAttendee)
  1213.         ) {
  1214.             // set the owning side to null (unless already changed)
  1215.             if ($invoiceItemAttendee->getPerson() === $this) {
  1216.                 $invoiceItemAttendee->setPerson(null);
  1217.             }
  1218.         }
  1219.         return $this;
  1220.     }
  1221. public function getIsInvoiceRecipient(): ?bool
  1222.     {
  1223.         return $this->isInvoiceRecipient;
  1224.     }
  1225.     public function setIsInvoiceRecipient(bool $isInvoiceRecipient): self
  1226.     {
  1227.         $this->isInvoiceRecipient $isInvoiceRecipient;
  1228.         return $this;
  1229.     }
  1230.     public function getCompany(): ?string
  1231.     {
  1232.         return $this->company;
  1233.     }
  1234.     public function setCompany(?string $company): self
  1235.     {
  1236.         $this->company $company;
  1237.         return $this;
  1238.     }
  1239.     
  1240.     /**
  1241.      * @return Collection<int, Invoice>
  1242.      */
  1243.     public function getInvoices(): Collection
  1244.     {
  1245.         return $this->invoices;
  1246.     }
  1247.     public function addInvoice(Invoice $invoice): self
  1248.     {
  1249.         if (!$this->invoices->contains($invoice)) {
  1250.             $this->invoices[] = $invoice;
  1251.             $invoice->setInvoiceAdressPerson($this);
  1252.         }
  1253.         return $this;
  1254.     }
  1255.     public function removeInvoice(Invoice $invoice): self
  1256.     {
  1257.         if ($this->invoices->removeElement($invoice)) {
  1258.             // set the owning side to null (unless already changed)
  1259.             if ($invoice->getInvoiceAdressPerson() === $this) {
  1260.                 $invoice->setInvoiceAdressPerson(null);
  1261.             }
  1262.         }
  1263.         return $this;
  1264.     }
  1265.     /**
  1266.      * @return Collection<int, Order>
  1267.      */
  1268.     public function getNo(): Collection
  1269.     {
  1270.         return $this->no;
  1271.     }
  1272.     public function addNo(Order $no): self
  1273.     {
  1274.         if (!$this->no->contains($no)) {
  1275.             $this->no[] = $no;
  1276.             $no->setInvoiceRecipient($this);
  1277.         }
  1278.         return $this;
  1279.     }
  1280.     public function removeNo(Order $no): self
  1281.     {
  1282.         if ($this->no->removeElement($no)) {
  1283.             // set the owning side to null (unless already changed)
  1284.             if ($no->getInvoiceRecipient() === $this) {
  1285.                 $no->setInvoiceRecipient(null);
  1286.             }
  1287.         }
  1288.         return $this;
  1289.     }
  1290.     /**
  1291.      * formatFamilyMember
  1292.      *
  1293.      * Format the Attributes for FamilyMembers.
  1294.      * Used in the Frontend.
  1295.      * 
  1296.      * @return array
  1297.      */
  1298.     public function formatFamilyMember()
  1299.     {
  1300.         return [
  1301.             'id' => $this->id,
  1302.             'title' => $this->title,
  1303.             'salutation' => $this->salutation,
  1304.             'member' => $this->member,
  1305.             'firstname' => $this->firstname,
  1306.             'lastname' => $this->lastname,
  1307.             'contactEmail' => $this->contactEmail,
  1308.             'dateOfBirth' => $this->dateOfBirth,
  1309.             'cityOfBirth' => $this->cityOfBirth,
  1310.             'comment' => $this->comment,
  1311.             'street' => $this->street,
  1312.             'streetNumber' => $this->streetNumber,
  1313.             'postalcode' => $this->postalcode,
  1314.             'city' => $this->city,
  1315.             'phone' => $this->phone,
  1316.             'mobile' => $this->mobile,
  1317.             'isInvoiceRecipient' => $this->isInvoiceRecipient,
  1318.         ];
  1319.     }
  1320.     /**
  1321.      * @return Collection<int, Presence>
  1322.      */
  1323.     public function getSigner(): Collection
  1324.     {
  1325.         return $this->signer;
  1326.     }
  1327.     public function addSigner(Presence $signer): self
  1328.     {
  1329.         if (!$this->signer->contains($signer)) {
  1330.             $this->signer[] = $signer;
  1331.             $signer->setPerson($this);
  1332.         }
  1333.         return $this;
  1334.     }
  1335.     public function removeSigner(Presence $signer): self
  1336.     {
  1337.         if ($this->signer->removeElement($signer)) {
  1338.             // set the owning side to null (unless already changed)
  1339.             if ($signer->getPerson() === $this) {
  1340.                 $signer->setPerson(null);
  1341.             }
  1342.         }
  1343.         return $this;
  1344.     }
  1345.     
  1346. }