src/Notaris/AdminBundle/Entity/Mailing.php line 20

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: lisavandaele
  5.  * Date: 30/01/15
  6.  * Time: 12:53
  7.  */
  8. namespace Notaris\AdminBundle\Entity;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Gedmo\Mapping\Annotation as Gedmo;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. use Doctrine\Common\Collections\ArrayCollection;
  13. /**
  14.  * @ORM\Entity(repositoryClass="MailingRepository")
  15.  * @ORM\Table(name="mailing")
  16.  */
  17. class Mailing {
  18.     /**
  19.      * @var integer
  20.      *
  21.      * @ORM\Column(name="id", type="integer")
  22.      * @ORM\Id
  23.      * @ORM\GeneratedValue(strategy="AUTO")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @Gedmo\Timestampable(on="create")
  28.      * @ORM\Column(name="created", type="datetime")
  29.      */
  30.     private $created;
  31.     /**
  32.      * @ORM\Column(name="type", type="string", columnDefinition="enum('newsletter', 'newsletter-test', 'mailing', 'mailing-test', 'kabinet-mailing', 'kabinet-mailing-test', 'calendar', 'simple')", nullable=true)
  33.      */
  34.     private $type;
  35.     /**
  36.      * @var string
  37.      *
  38.      * @ORM\Column(name="locale", type="string", length=5)
  39.      */
  40.     private $locale;
  41.     /**
  42.      * @ORM\ManyToOne(targetEntity="Notaris\AdminBundle\Entity\User")
  43.      * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="SET NULL")
  44.      */
  45.     private $user;
  46.     /**
  47.      * @ORM\Column(name="to_group", type="string", columnDefinition="enum('N', 'N-SVEN-ADMIN', 'N-WITH-SVEN', 'N-WITHOUT-SVEN', 'S', '0', 'ER')", nullable=true)
  48.      */
  49.     private $toGroup;
  50.     /**
  51.      * @var string
  52.      *
  53.      * @ORM\Column(name="from_name", type="string", length=255, nullable=true)
  54.      */
  55.     private $fromName;
  56.     /**
  57.      * @var string
  58.      *
  59.      * @ORM\Column(name="from_email", type="string", length=255)
  60.      */
  61.     private $fromEmail;
  62.     /**
  63.      * @var string
  64.      *
  65.      * @ORM\Column(name="mailing_to", type="string", length=255, nullable=true)
  66.      */
  67.     private $to;
  68.     /**
  69.      * @var string
  70.      *
  71.      * @ORM\Column(name="mailing_cc", type="string", length=255, nullable=true)
  72.      */
  73.     private $cc;
  74.     /**
  75.      * @var string
  76.      *
  77.      * @ORM\Column(name="mail_subject", type="string", length=255, nullable=true)
  78.      */
  79.     private $mailSubject;
  80.     /**
  81.      * @var string
  82.      *
  83.      * @ORM\Column(name="title", type="string", length=255, nullable=true)
  84.      */
  85.     private $title;
  86.     /**
  87.      * @var string
  88.      *
  89.      * @ORM\Column(name="number", type="integer", length=255, nullable=true)
  90.      */
  91.     private $number;
  92.     /**
  93.      * @var string
  94.      *
  95.      * @ORM\Column(name="number_notary", type="string", length=255, nullable=true)
  96.      */
  97.     private $numberNotary;
  98.     /**
  99.      * @var string
  100.      *
  101.      * @ORM\Column(name="timerange", type="string", length=255, nullable=true)
  102.      */
  103.     private $timerange;
  104.     /**
  105.      * @ORM\Column(type="text", name="description", nullable=true)
  106.      */
  107.     private $description;
  108.     /**
  109.      * @ORM\OneToOne(targetEntity="Asset")
  110.      * @ORM\JoinColumn(name="asset_id", referencedColumnName="id")
  111.      */
  112.     protected $asset;
  113.     /**
  114.      * @ORM\Column(type="text", name="html_body", nullable=true)
  115.      */
  116.     private $htmlBody;
  117.     /**
  118.      * @ORM\Column(type="text", name="html_browser", nullable=true)
  119.      */
  120.     private $htmlBrowser;
  121.     /**
  122.      * @ORM\OneToMany(targetEntity="Notaris\AdminBundle\Entity\MailingTo", mappedBy="mailing")
  123.      */
  124.     private $mails;
  125.     /**
  126.      * @ORM\Column(name="date_ready_to_send", type="datetime", nullable=true)
  127.      */
  128.     private $dateReadyToSend;
  129.     /**
  130.      * @ORM\Column(name="date_in_queue", type="datetime", nullable=true)
  131.      */
  132.     private $dateInQueue;
  133.     /**
  134.      * @ORM\Column(type="simple_array", name="subgroups", nullable=true)
  135.      */
  136.     protected $subgroups;
  137.     /**
  138.      * @ORM\Column(type="boolean", name="is_test")
  139.      * @Assert\Type("boolean")
  140.      */
  141.     private $isTest;
  142.     /**
  143.      * @Gedmo\Slug(fields={"mailSubject","number","title"})
  144.      * @ORM\Column(length=128)
  145.      */
  146.     private $slug;
  147.     /**
  148.      * @ORM\OneToMany(targetEntity="NewsMailing", mappedBy="mailing")
  149.      */
  150.     private $news;
  151.     /**
  152.      * @ORM\OneToMany(targetEntity="ArticleMailing", mappedBy="mailing")
  153.      */
  154.     private $articles;
  155.     /**
  156.      * @var string
  157.      *
  158.      * @ORM\Column(name="attachments", type="json", nullable=true)
  159.      */
  160.     private $attachments;
  161.     /**
  162.      * Constructor
  163.      */
  164.     public function __construct()
  165.     {
  166.         $this->mails = new ArrayCollection();
  167.         $this->isTest = false;
  168.     }
  169.     /**
  170.      * Get id
  171.      *
  172.      * @return integer
  173.      */
  174.     public function getId()
  175.     {
  176.         return $this->id;
  177.     }
  178.     /**
  179.      * Set created
  180.      *
  181.      * @param \DateTime $created
  182.      * @return Mailing
  183.      */
  184.     public function setCreated($created)
  185.     {
  186.         $this->created = $created;
  187.         return $this;
  188.     }
  189.     /**
  190.      * Get created
  191.      *
  192.      * @return \DateTime
  193.      */
  194.     public function getCreated()
  195.     {
  196.         return $this->created;
  197.     }
  198.     /**
  199.      * Set type
  200.      *
  201.      * @param string $type
  202.      * @return Mailing
  203.      */
  204.     public function setType($type)
  205.     {
  206.         $this->type = $type;
  207.         return $this;
  208.     }
  209.     /**
  210.      * Get type
  211.      *
  212.      * @return string
  213.      */
  214.     public function getType()
  215.     {
  216.         return $this->type;
  217.     }
  218.     /**
  219.      * Set locale
  220.      *
  221.      * @param string $locale
  222.      * @return Mailing
  223.      */
  224.     public function setLocale($locale)
  225.     {
  226.         $this->locale = $locale;
  227.         return $this;
  228.     }
  229.     /**
  230.      * Get locale
  231.      *
  232.      * @return string
  233.      */
  234.     public function getLocale()
  235.     {
  236.         return $this->locale;
  237.     }
  238.     /**
  239.      * Set toGroup
  240.      *
  241.      * @param string $toGroup
  242.      * @return Mailing
  243.      */
  244.     public function setToGroup($toGroup)
  245.     {
  246.         $this->toGroup = $toGroup;
  247.         return $this;
  248.     }
  249.     /**
  250.      * Get toGroup
  251.      *
  252.      * @return string
  253.      */
  254.     public function getToGroup()
  255.     {
  256.         return $this->toGroup;
  257.     }
  258.     /**
  259.      * Set fromName
  260.      *
  261.      * @param string $fromName
  262.      * @return Mailing
  263.      */
  264.     public function setFromName($fromName)
  265.     {
  266.         $this->fromName = $fromName;
  267.         return $this;
  268.     }
  269.     /**
  270.      * Get fromName
  271.      *
  272.      * @return string
  273.      */
  274.     public function getFromName()
  275.     {
  276.         return $this->fromName;
  277.     }
  278.     /**
  279.      * Set fromEmail
  280.      *
  281.      * @param string $fromEmail
  282.      * @return Mailing
  283.      */
  284.     public function setFromEmail($fromEmail)
  285.     {
  286.         $this->fromEmail = $fromEmail;
  287.         return $this;
  288.     }
  289.     /**
  290.      * Get fromEmail
  291.      *
  292.      * @return string
  293.      */
  294.     public function getFromEmail()
  295.     {
  296.         return $this->fromEmail;
  297.     }
  298.     /**
  299.      * Set to
  300.      *
  301.      * @param string $to
  302.      * @return Mailing
  303.      */
  304.     public function setTo($to)
  305.     {
  306.         $this->to = $to;
  307.         return $this;
  308.     }
  309.     /**
  310.      * Get to
  311.      *
  312.      * @return string
  313.      */
  314.     public function getTo()
  315.     {
  316.         return $this->to;
  317.     }
  318.     /**
  319.      * @return string
  320.      */
  321.     public function getMailSubject()
  322.     {
  323.         return $this->mailSubject;
  324.     }
  325.     /**
  326.      * Set title
  327.      *
  328.      * @param string $title
  329.      * @return Mailing
  330.      */
  331.     public function setMailSubject($mailSubject)
  332.     {
  333.         $this->mailSubject = $mailSubject;
  334.         return $this;
  335.     }
  336.     /**
  337.      * Set title
  338.      *
  339.      * @param string $title
  340.      * @return Mailing
  341.      */
  342.     public function setTitle($title)
  343.     {
  344.         $this->title = $title;
  345.         return $this;
  346.     }
  347.     /**
  348.      * Get title
  349.      *
  350.      * @return string
  351.      */
  352.     public function getTitle()
  353.     {
  354.         return $this->title;
  355.     }
  356.     /**
  357.      * Set description
  358.      *
  359.      * @param string $description
  360.      * @return Mailing
  361.      */
  362.     public function setDescription($description)
  363.     {
  364.         $this->description = $description;
  365.         return $this;
  366.     }
  367.     /**
  368.      * Get description
  369.      *
  370.      * @return string
  371.      */
  372.     public function getDescription()
  373.     {
  374.         return $this->description;
  375.     }
  376.     /**
  377.      * Set htmlBody
  378.      *
  379.      * @param string $htmlBody
  380.      * @return Mailing
  381.      */
  382.     public function setHtmlBody($htmlBody)
  383.     {
  384.         $this->htmlBody = $htmlBody;
  385.         return $this;
  386.     }
  387.     /**
  388.      * Get htmlBody
  389.      *
  390.      * @return string
  391.      */
  392.     public function getHtmlBody()
  393.     {
  394.         return $this->htmlBody;
  395.     }
  396.     /**
  397.      * Set user
  398.      *
  399.      * @param \Notaris\AdminBundle\Entity\User $user
  400.      * @return Mailing
  401.      */
  402.     public function setUser(\Notaris\AdminBundle\Entity\User $user = null)
  403.     {
  404.         $this->user = $user;
  405.         return $this;
  406.     }
  407.     /**
  408.      * Get user
  409.      *
  410.      * @return \Notaris\AdminBundle\Entity\User
  411.      */
  412.     public function getUser()
  413.     {
  414.         return $this->user;
  415.     }
  416.     /**
  417.      * Set asset
  418.      *
  419.      * @param \Notaris\AdminBundle\Entity\Asset $asset
  420.      * @return Mailing
  421.      */
  422.     public function setAsset(\Notaris\AdminBundle\Entity\Asset $asset = null)
  423.     {
  424.         $this->asset = $asset;
  425.         return $this;
  426.     }
  427.     /**
  428.      * Get asset
  429.      *
  430.      * @return \Notaris\AdminBundle\Entity\Asset
  431.      */
  432.     public function getAsset()
  433.     {
  434.         return $this->asset;
  435.     }
  436.     /**
  437.      * Set htmlBrowser
  438.      *
  439.      * @param string $htmlBrowser
  440.      *
  441.      * @return Mailing
  442.      */
  443.     public function setHtmlBrowser($htmlBrowser)
  444.     {
  445.         $this->htmlBrowser = $htmlBrowser;
  446.         return $this;
  447.     }
  448.     /**
  449.      * Get htmlBrowser
  450.      *
  451.      * @return string
  452.      */
  453.     public function getHtmlBrowser()
  454.     {
  455.         return $this->htmlBrowser;
  456.     }
  457.     /**
  458.      * Add mail
  459.      *
  460.      * @param \Notaris\AdminBundle\Entity\MailingTo $mail
  461.      *
  462.      * @return Mailing
  463.      */
  464.     public function addMail(\Notaris\AdminBundle\Entity\MailingTo $mail)
  465.     {
  466.         $this->mails[] = $mail;
  467.         return $this;
  468.     }
  469.     /**
  470.      * Remove mail
  471.      *
  472.      * @param \Notaris\AdminBundle\Entity\MailingTo $mail
  473.      */
  474.     public function removeMail(\Notaris\AdminBundle\Entity\MailingTo $mail)
  475.     {
  476.         $this->mails->removeElement($mail);
  477.     }
  478.     /**
  479.      * Get mails
  480.      *
  481.      * @return \Doctrine\Common\Collections\Collection
  482.      */
  483.     public function getMails()
  484.     {
  485.         return $this->mails;
  486.     }
  487.     /**
  488.      * Set dateReadyToSend
  489.      *
  490.      * @param \DateTime $dateReadyToSend
  491.      *
  492.      * @return Mailing
  493.      */
  494.     public function setDateReadyToSend($dateReadyToSend)
  495.     {
  496.         $this->dateReadyToSend = $dateReadyToSend;
  497.         return $this;
  498.     }
  499.     /**
  500.      * Get dateReadyToSend
  501.      *
  502.      * @return \DateTime
  503.      */
  504.     public function getDateReadyToSend()
  505.     {
  506.         return $this->dateReadyToSend;
  507.     }
  508.     /**
  509.      * Set subgroups
  510.      *
  511.      * @param array $subgroups
  512.      *
  513.      * @return Mailing
  514.      */
  515.     public function setSubgroups($subgroups)
  516.     {
  517.         $this->subgroups = $subgroups;
  518.         return $this;
  519.     }
  520.     /**
  521.      * Get subgroups
  522.      *
  523.      * @return array
  524.      */
  525.     public function getSubgroups()
  526.     {
  527.         return $this->subgroups;
  528.     }
  529.     /**
  530.      * Set isTest
  531.      *
  532.      * @param boolean $isTest
  533.      *
  534.      * @return Mailing
  535.      */
  536.     public function setIsTest($isTest)
  537.     {
  538.         $this->isTest = $isTest;
  539.         return $this;
  540.     }
  541.     /**
  542.      * Get isTest
  543.      *
  544.      * @return boolean
  545.      */
  546.     public function getIsTest()
  547.     {
  548.         return $this->isTest;
  549.     }
  550.     /**
  551.      * Set dateInQueue
  552.      *
  553.      * @param \DateTime $dateInQueue
  554.      *
  555.      * @return Mailing
  556.      */
  557.     public function setDateInQueue($dateInQueue)
  558.     {
  559.         $this->dateInQueue = $dateInQueue;
  560.         return $this;
  561.     }
  562.     /**
  563.      * Get dateInQueue
  564.      *
  565.      * @return \DateTime
  566.      */
  567.     public function getDateInQueue()
  568.     {
  569.         return $this->dateInQueue;
  570.     }
  571.     /**
  572.      * Set timerange
  573.      *
  574.      * @param string $timerange
  575.      *
  576.      * @return Mailing
  577.      */
  578.     public function setTimerange($timerange)
  579.     {
  580.         $this->timerange = $timerange;
  581.         return $this;
  582.     }
  583.     /**
  584.      * Get timerange
  585.      *
  586.      * @return string
  587.      */
  588.     public function getTimerange()
  589.     {
  590.         return $this->timerange;
  591.     }
  592.     /**
  593.      * Set number
  594.      *
  595.      * @param integer $number
  596.      *
  597.      * @return Mailing
  598.      */
  599.     public function setNumber($number)
  600.     {
  601.         $this->number = $number;
  602.         return $this;
  603.     }
  604.     /**
  605.      * Get number
  606.      *
  607.      * @return integer
  608.      */
  609.     public function getNumber()
  610.     {
  611.         return $this->number;
  612.     }
  613.     /**
  614.      * Set slug
  615.      *
  616.      * @param string $slug
  617.      *
  618.      * @return Mailing
  619.      */
  620.     public function setSlug($slug)
  621.     {
  622.         $this->slug = $slug;
  623.         return $this;
  624.     }
  625.     /**
  626.      * Get slug
  627.      *
  628.      * @return string
  629.      */
  630.     public function getSlug()
  631.     {
  632.         return $this->slug;
  633.     }
  634.     /**
  635.      * Add news
  636.      *
  637.      * @param \Notaris\AdminBundle\Entity\NewsMailing $news
  638.      *
  639.      * @return Mailing
  640.      */
  641.     public function addNews(\Notaris\AdminBundle\Entity\NewsMailing $news)
  642.     {
  643.         $this->news[] = $news;
  644.         return $this;
  645.     }
  646.     /**
  647.      * Remove news
  648.      *
  649.      * @param \Notaris\AdminBundle\Entity\NewsMailing $news
  650.      */
  651.     public function removeNews(\Notaris\AdminBundle\Entity\NewsMailing $news)
  652.     {
  653.         $this->news->removeElement($news);
  654.     }
  655.     /**
  656.      * Get news
  657.      *
  658.      * @return \Doctrine\Common\Collections\Collection
  659.      */
  660.     public function getNews()
  661.     {
  662.         return $this->news;
  663.     }
  664.     /**
  665.      * Add article
  666.      *
  667.      * @param \Notaris\AdminBundle\Entity\Article $article
  668.      *
  669.      * @return Mailing
  670.      */
  671.     public function addArticle(\Notaris\AdminBundle\Entity\Article $article)
  672.     {
  673.         $this->articles[] = $article;
  674.         return $this;
  675.     }
  676.     /**
  677.      * Remove article
  678.      *
  679.      * @param \Notaris\AdminBundle\Entity\Article $article
  680.      */
  681.     public function removeArticle(\Notaris\AdminBundle\Entity\Article $article)
  682.     {
  683.         $this->articles->removeElement($article);
  684.     }
  685.     /**
  686.      * Get articles
  687.      *
  688.      * @return \Doctrine\Common\Collections\Collection
  689.      */
  690.     public function getArticles()
  691.     {
  692.         return $this->articles;
  693.     }
  694.     /**
  695.      * Set numberNotary
  696.      *
  697.      * @param string $numberNotary
  698.      *
  699.      * @return Mailing
  700.      */
  701.     public function setNumberNotary($numberNotary)
  702.     {
  703.         $this->numberNotary = $numberNotary;
  704.         return $this;
  705.     }
  706.     /**
  707.      * Get numberNotary
  708.      *
  709.      * @return string
  710.      */
  711.     public function getNumberNotary()
  712.     {
  713.         return $this->numberNotary;
  714.     }
  715.     /**
  716.      * Set cc
  717.      *
  718.      * @param string $cc
  719.      *
  720.      * @return Mailing
  721.      */
  722.     public function setCc($cc)
  723.     {
  724.         $this->cc = $cc;
  725.         return $this;
  726.     }
  727.     /**
  728.      * Get cc
  729.      *
  730.      * @return string
  731.      */
  732.     public function getCc()
  733.     {
  734.         return $this->cc;
  735.     }
  736.     /**
  737.      * Set attachments
  738.      *
  739.      * @param array $attachments
  740.      *
  741.      * @return Mailing
  742.      */
  743.     public function setAttachments($attachments)
  744.     {
  745.         $this->attachments = $attachments;
  746.         return $this;
  747.     }
  748.     /**
  749.      * Get attachments
  750.      *
  751.      * @return array
  752.      */
  753.     public function getAttachments()
  754.     {
  755.         return $this->attachments;
  756.     }
  757. }