src/Entity/EventContact.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;
  5. /**
  6.  * EventContact
  7.  *
  8.  * @ORM\Table(name="event_contact")
  9.  * @ORM\Entity(repositoryClass="App\Repository\EventContactRepository")
  10.  */
  11. class EventContact implements EntityInterface
  12. {
  13.     use \Gedmo\Timestampable\Traits\TimestampableEntity;
  14.     use BlameableEntity;
  15.     use SoftDeleteableEntity;
  16.     /**
  17.      * @var int
  18.      *
  19.      * @ORM\Column(name="id", type="integer")
  20.      * @ORM\Id
  21.      * @ORM\GeneratedValue(strategy="AUTO")
  22.      */
  23.     private $id;
  24.     /**
  25.      * @var string
  26.      * @ORM\Column(name="status", type="string", length=20, nullable=true)
  27.      */
  28.     private $status EntityInterface::STATUS_DISABLED;
  29.     /**
  30.      * @var string
  31.      * @ORM\Column(name="first_name", type="string",length=255, nullable=true)
  32.      */
  33.     private $firstName;
  34.     /**
  35.      * @var string
  36.      * @ORM\Column(name="last_name", type="string", length=255, nullable=true)
  37.      */
  38.     private $lastName;
  39.     /**
  40.      * @var string
  41.      * @ORM\Column(name="email", type="string", length=255, nullable=true)
  42.      */
  43.     private $email;
  44.     /**
  45.      * @var string
  46.      * @ORM\Column(name="phone", type="string", length=255, nullable=true)
  47.      */
  48.     private $phone;
  49.     /**
  50.      * @var string
  51.      * @ORM\Column(name="event_email", type="string", length=255, nullable=true)
  52.      */
  53.     private $eventEmail;
  54.     /**
  55.      * @var string
  56.      * @ORM\Column(name="event_phone", type="string", length=255, nullable=true)
  57.      */
  58.     private $eventPhone;
  59.     /**
  60.      * @var string
  61.      * @ORM\Column(name="event_role", type="string", length=255, nullable=true)
  62.      */
  63.     private $eventRole;
  64.     /**
  65.      * @var string
  66.      * @ORM\Column(name="organization_code", type="string", length=255, nullable=true)
  67.      */
  68.     private $organizationCode;
  69.     /**
  70.      * @var string
  71.      * @ORM\Column(name="organization_name", type="string", length=255, nullable=true)
  72.      */
  73.     private $organizationName;
  74.     /**
  75.      * @var EventGroupContactsHost $groupContactsHost
  76.      * @ORM\ManyToOne(targetEntity="EventGroupContactsHost", inversedBy="contacts", cascade={"persist"})
  77.      * @ORM\JoinColumn(name="group_contacts_host_id", referencedColumnName="id")
  78.      */
  79.     private $groupContactsHost;
  80.     /**
  81.      * @var EventGroupContactsRights $groupContactsRights
  82.      * @ORM\ManyToOne(targetEntity="EventGroupContactsRights", inversedBy="contacts", cascade={"persist"})
  83.      * @ORM\JoinColumn(name="group_contacts_rights_id", referencedColumnName="id")
  84.      */
  85.     private $groupContactsRights;
  86.     /**
  87.      * @var EventGroupContactsOthers $groupContactsOthers
  88.      * @ORM\ManyToOne(targetEntity="EventGroupContactsOthers", inversedBy="contacts", cascade={"persist"})
  89.      * @ORM\JoinColumn(name="group_contacts_others_id", referencedColumnName="id")
  90.      */
  91.     private $groupContactsOthers;
  92.     /**
  93.      * @var EventGroupContactsAccreditation $groupContactsAccreditation
  94.      * @ORM\ManyToOne(targetEntity="EventGroupContactsAccreditation", inversedBy="contacts", cascade={"persist"})
  95.      * @ORM\JoinColumn(name="group_contacts_accreditation_id", referencedColumnName="id")
  96.      */
  97.     private $groupContactsAccreditation;
  98.     /**
  99.      * @var EventGroupContactsOnSite $groupContactsOnSite
  100.      * @ORM\ManyToOne(targetEntity="EventGroupContactsOnSite", inversedBy="contacts", cascade={"persist"})
  101.      * @ORM\JoinColumn(name="group_contacts_onsite_id", referencedColumnName="id")
  102.      */
  103.     private $groupContactsOnSite;
  104.     /**
  105.      * @return EventGroupContactsOnSite
  106.      */
  107.     public function getGroupContactsOnSite(): EventGroupContactsOnSite
  108.     {
  109.         return $this->groupContactsOnSite;
  110.     }
  111.     /**
  112.      * @param EventGroupContactsOnSite $groupContactsOnSite
  113.      */
  114.     public function setGroupContactsOnSite(EventGroupContactsOnSite $groupContactsOnSite): void
  115.     {
  116.         $this->groupContactsOnSite $groupContactsOnSite;
  117.     }
  118.     /**
  119.      * @return EventGroupContactsAccreditation
  120.      */
  121.     public function getGroupContactsAccreditation(): ?EventGroupContactsAccreditation
  122.     {
  123.         return $this->groupContactsAccreditation;
  124.     }
  125.     /**
  126.      * @param EventGroupContactsAccreditation $groupContactsAccreditation
  127.      */
  128.     public function setGroupContactsAccreditation(EventGroupContactsAccreditation $groupContactsAccreditation null): void
  129.     {
  130.         $this->groupContactsAccreditation $groupContactsAccreditation;
  131.     }
  132.     /**
  133.      * @return mixed
  134.      */
  135.     public function getGroupContactsRights(): ?EventGroupContactsRights
  136.     {
  137.         return $this->groupContactsRights;
  138.     }
  139.     /**
  140.      * @param mixed $groupContactsRights
  141.      */
  142.     public function setGroupContactsRights(EventGroupContactsRights $groupContactsRights null): void
  143.     {
  144.         $this->groupContactsRights $groupContactsRights;
  145.     }
  146.     /**
  147.      * @param mixed $groupContactsOthers
  148.      */
  149.     public function setGroupContactsOthers(EventGroupContactsOthers $groupContactsOthers null): void
  150.     {
  151.         $this->groupContactsOthers $groupContactsOthers;
  152.     }
  153.     /**
  154.      * @return int
  155.      */
  156.     public function getId(): int
  157.     {
  158.         return $this->id;
  159.     }
  160.     /**
  161.      * @param int $id
  162.      */
  163.     public function setId(int $id)
  164.     {
  165.         $this->id $id;
  166.     }
  167.     /**
  168.      * @return string
  169.      */
  170.     public function getPhone(): ?string
  171.     {
  172.         return $this->phone;
  173.     }
  174.     /**
  175.      * @param string $phone
  176.      */
  177.     public function setPhone(string $phone null)
  178.     {
  179.         $this->phone $phone;
  180.     }
  181.     public function isActivated(): bool
  182.     {
  183.         return $this->status === EntityInterface::STATUS_ACTIVE;
  184.     }
  185.     /**
  186.      * @return string
  187.      */
  188.     public function getEventEmail(): ?string
  189.     {
  190.         return $this->eventEmail;
  191.     }
  192.     /**
  193.      * @param string $eventEmail
  194.      */
  195.     public function setEventEmail(string $eventEmail null)
  196.     {
  197.         $this->eventEmail $eventEmail;
  198.     }
  199.     /**
  200.      * @return string
  201.      */
  202.     public function getEventPhone(): ?string
  203.     {
  204.         return $this->eventPhone;
  205.     }
  206.     /**
  207.      * @param string $eventPhone
  208.      */
  209.     public function setEventPhone(string $eventPhone null)
  210.     {
  211.         $this->eventPhone $eventPhone;
  212.     }
  213.     /**
  214.      * @return string
  215.      */
  216.     public function getEventRole(): ?string
  217.     {
  218.         return $this->eventRole;
  219.     }
  220.     /**
  221.      * @param string $eventRole
  222.      */
  223.     public function setEventRole(string $eventRole null)
  224.     {
  225.         $this->eventRole $eventRole;
  226.     }
  227.     /**
  228.      * @return string
  229.      */
  230.     public function getOrganizationCode(): ?string
  231.     {
  232.         return $this->organizationCode;
  233.     }
  234.     /**
  235.      * @param string $organizationCode
  236.      */
  237.     public function setOrganizationCode(string $organizationCode null)
  238.     {
  239.         $this->organizationCode $organizationCode;
  240.     }
  241.     /**
  242.      * @return string
  243.      */
  244.     public function getOrganizationName(): ?string
  245.     {
  246.         return $this->organizationName;
  247.     }
  248.     /**
  249.      * @param string $organizationName
  250.      */
  251.     public function setOrganizationName(string $organizationName null)
  252.     {
  253.         $this->organizationName $organizationName;
  254.     }
  255.     /**
  256.      * @return mixed
  257.      */
  258.     public function getGroupContactsHost(): ?EventGroupContactsHost
  259.     {
  260.         return $this->groupContactsHost;
  261.     }
  262.     /**
  263.      * @param mixed $groupContactsHost
  264.      */
  265.     public function setGroupContactsHost(EventGroupContactsHost $groupContactsHost): void
  266.     {
  267.         $this->groupContactsHost $groupContactsHost;
  268.     }
  269.     public function toString(): string
  270.     {
  271.         return "{id=" $this->id "}";
  272.     }
  273.     public function __toString()
  274.     {
  275.         return $this->getDisplayName();
  276.     }
  277.     public function getDisplayName(): string
  278.     {
  279.         $res '';
  280.         if ($this->getFirstName() != null) {
  281.             $res $this->getFirstName();
  282.         }
  283.         if ($this->getLastName() != null) {
  284.             $res ' ' $this->getLastName();
  285.         }
  286.         $res trim($res);
  287.         if ($this->getEmail() != null) {
  288.             if ($res == '') {
  289.                 $res $this->getEmail();
  290.             } else {
  291.                 $res $res ' [' $this->getEmail() . ']';
  292.             }
  293.         }
  294.         return $res;
  295.     }
  296.     /**
  297.      * @return string
  298.      */
  299.     public function getFirstName(): ?string
  300.     {
  301.         return $this->firstName;
  302.     }
  303.     /**
  304.      * @param string $firstName
  305.      */
  306.     public function setFirstName(string $firstName null)
  307.     {
  308.         $this->firstName $firstName;
  309.     }
  310.     /**
  311.      * @return string
  312.      */
  313.     public function getLastName(): ?string
  314.     {
  315.         return $this->lastName;
  316.     }
  317.     /**
  318.      * @param string $lastName
  319.      */
  320.     public function setLastName(string $lastName null)
  321.     {
  322.         $this->lastName $lastName;
  323.     }
  324.     /**
  325.      * @return string
  326.      */
  327.     public function getEmail(): ?string
  328.     {
  329.         return $this->email;
  330.     }
  331.     /**
  332.      * @param string $email
  333.      */
  334.     public function setEmail(string $email null)
  335.     {
  336.         $this->email $email;
  337.     }
  338.     public function getKey()
  339.     {
  340.         return $this->buildKey($this->getFirstName(), $this->getLastName(), $this->getEmail());
  341.     }
  342.     /**
  343.      * @param $initFirstName
  344.      * @param $initLastName
  345.      * @param $initEmail
  346.      * @return string
  347.      */
  348.     public static function buildKey(
  349.         string $initFirstName null,
  350.         string $initLastName null,
  351.         string $initEmail null
  352.     ): string
  353.     {
  354.         $firstName = empty(trim($initFirstName)) ? "null" $initFirstName;
  355.         $lastName = empty(trim($initLastName)) ? "null" $initLastName;
  356.         $email = empty(trim($initEmail)) ? "null" $initEmail;
  357.         return $firstName ' - ' $lastName ' - ' $email;
  358.     }
  359.     /**
  360.      * @return string
  361.      */
  362.     public function getStatus(): string
  363.     {
  364.         return $this->status;
  365.     }
  366.     /**
  367.      * @param string $status
  368.      */
  369.     public function setStatus(string $status)
  370.     {
  371.         $this->status $status;
  372.     }
  373. }