src/AtechNet/CoreBundle/Entity/CustomerSentEmail.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\AtechNet\CoreBundle\Entity;
  3. use App\AtechNet\CoreBundle\Translation\TranslatorInterface;
  4. use Doctrine\ORM\Mapping\Column;
  5. use Doctrine\ORM\Mapping\Entity;
  6. use Doctrine\ORM\Mapping\JoinColumn;
  7. use Doctrine\ORM\Mapping\ManyToOne;
  8. use Doctrine\ORM\Mapping\Table as Table;
  9. /**
  10.  * CustomerSentEmail
  11.  *
  12.  * @Table(name="customers__sent_emails")
  13.  * @Entity
  14.  */
  15. class CustomerSentEmail extends AbstractEntity
  16. {
  17.     /**
  18.      * @var Customer
  19.      *
  20.      * @ManyToOne(targetEntity="Customer", inversedBy="sentEmails")
  21.      * @JoinColumn(name="customer", referencedColumnName="id")
  22.      */
  23.     private $customer;
  24.     public const EventType_Registration = 'Registration';
  25.     public const EventType_NewOrder = 'New order';
  26.     public const EventType_OrderStatusChange = 'Order status change';
  27.     public const EventType_Campaign = 'Campaign';
  28.     public const EventType_AccountActivationReminder = 'Account activation reminder';
  29.     public const EventType_Notice = 'Notice';
  30.     public const EventType_NotLoggedInReminder = 'Not logged in reminder';
  31.     public const EventType_Newsletter = 'Newsletter';
  32.     public function getEventTypeChoices()
  33.     {
  34.         return [
  35.             0 => self::EventType_Registration,
  36.             1 => self::EventType_NewOrder,
  37.             2 => self::EventType_OrderStatusChange,
  38.             3 => self::EventType_Campaign,
  39.             4 => self::EventType_AccountActivationReminder,
  40.             5 => self::EventType_Notice,
  41.             6 => self::EventType_NotLoggedInReminder,
  42.             7 => self::EventType_Newsletter,
  43.         ];
  44.     }
  45.     /**
  46.      * @var integer
  47.      *
  48.      * @Column(name="event", type="integer")
  49.      */
  50.     private $event;
  51.     /**
  52.      * @var string
  53.      *
  54.      * @Column(name="fromEmail", type="string", length=255)
  55.      */
  56.     private $fromEmail;
  57.     /**
  58.      * @var string
  59.      *
  60.      * @Column(name="toEmail", type="string", length=255)
  61.      */
  62.     private $toEmail;
  63.     /**
  64.      * @var string
  65.      *
  66.      * @Column(name="subject", type="string", length=255)
  67.      */
  68.     private $subject;
  69.     /**
  70.      * @var string
  71.      *
  72.      * @Column(name="body", type="text")
  73.      */
  74.     private $body;
  75.     /**
  76.      * @return Customer
  77.      */
  78.     public function getCustomer()
  79.     {
  80.         return $this->customer;
  81.     }
  82.     /**
  83.      * @param Customer $customer
  84.      */
  85.     public function setCustomer($customer)
  86.     {
  87.         $this->customer = $customer;
  88.     }
  89.     /**
  90.      * Set event
  91.      *
  92.      * @param integer $event
  93.      * @return CustomerSentEmail
  94.      */
  95.     public function setEvent($event)
  96.     {
  97.         $this->event = $event;
  98.         return $this;
  99.     }
  100.     /**
  101.      * Get event
  102.      *
  103.      * @return integer
  104.      */
  105.     public function getEvent()
  106.     {
  107.         return $this->event;
  108.     }
  109.     /**
  110.      * Set fromEmail
  111.      *
  112.      * @param string $fromEmail
  113.      * @return CustomerSentEmail
  114.      */
  115.     public function setFromEmail($fromEmail)
  116.     {
  117.         $this->fromEmail = $fromEmail;
  118.         return $this;
  119.     }
  120.     /**
  121.      * Get fromEmail
  122.      *
  123.      * @return string
  124.      */
  125.     public function getFromEmail()
  126.     {
  127.         return $this->fromEmail;
  128.     }
  129.     /**
  130.      * Set toEmail
  131.      *
  132.      * @param string $toEmail
  133.      * @return CustomerSentEmail
  134.      */
  135.     public function setToEmail($toEmail)
  136.     {
  137.         $this->toEmail = $toEmail;
  138.         return $this;
  139.     }
  140.     /**
  141.      * Get toEmail
  142.      *
  143.      * @return string
  144.      */
  145.     public function getToEmail()
  146.     {
  147.         return $this->toEmail;
  148.     }
  149.     /**
  150.      * @return string
  151.      */
  152.     public function getSubject()
  153.     {
  154.         return $this->subject;
  155.     }
  156.     /**
  157.      * @param string $subject
  158.      */
  159.     public function setSubject($subject)
  160.     {
  161.         $this->subject = $subject;
  162.     }
  163.     /**
  164.      * Set body
  165.      *
  166.      * @param string $body
  167.      * @return CustomerSentEmail
  168.      */
  169.     public function setBody($body)
  170.     {
  171.         $this->body = $body;
  172.         return $this;
  173.     }
  174.     /**
  175.      * Get body
  176.      *
  177.      * @return string
  178.      */
  179.     public function getBody()
  180.     {
  181.         return $this->body;
  182.     }
  183.     /**
  184.      * Returns the title of event for current object
  185.      * If translator is set, translates it
  186.      *
  187.      * @param TranslatorInterface $translator
  188.      * @return string
  189.      */
  190.     public function getEventTitle(TranslatorInterface $translator = null)
  191.     {
  192.         return is_null($translator) ? $this->getEventTypeChoices()[$this->getEvent()] : $translator->trans($this->getEventTypeChoices()[$this->getEvent()]);
  193.     }
  194. }