src/Entity/EventGroupContactsHost.php line 20

Open in your IDE?
  1. <?php
  2. /**
  3.  * User: deniger
  4.  * Date: 21/03/2018
  5.  * Time: 13:29
  6.  */
  7. namespace App\Entity;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. /**
  12.  * EventGroupContactsHost
  13.  *
  14.  * @ORM\Table(name="event_group_contacts_host")
  15.  * @ORM\Entity
  16.  */
  17. class EventGroupContactsHost extends EventGroupContactsMapped
  18. {
  19.     /**
  20.      *
  21.      * @var ArrayCollection
  22.      *
  23.      * @ORM\OneToMany(targetEntity="App\Entity\EventContact",  mappedBy="groupContactsHost",cascade={"all"})
  24.      * @ORM\OrderBy({"firstName" = "ASC"})
  25.      */
  26.     private $contacts;
  27.     public function __construct()
  28.     {
  29.         $this->contacts = new ArrayCollection();
  30.     }
  31.     /**
  32.      * @return ArrayCollection
  33.      */
  34.     public function getContacts(): Collection
  35.     {
  36.         return $this->contacts;
  37.     }
  38.     /**
  39.      * @param Collection $contacts
  40.      */
  41.     public function setContacts(Collection $contacts): void
  42.     {
  43.         $this->contacts $contacts;
  44.     }
  45.     public function addContact(EventContact $contact)
  46.     {
  47.         $this->contacts[] = $contact;
  48.         $contact->setGroupContactsHost($this);
  49.     }
  50. }