<?php
/**
* Created by PhpStorm.
* User: lisavandaele
* Date: 30/01/15
* Time: 12:53
*/
namespace Notaris\AdminBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity(repositoryClass="MailingRepository")
* @ORM\Table(name="mailing")
*/
class Mailing {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @Gedmo\Timestampable(on="create")
* @ORM\Column(name="created", type="datetime")
*/
private $created;
/**
* @ORM\Column(name="type", type="string", columnDefinition="enum('newsletter', 'newsletter-test', 'mailing', 'mailing-test', 'kabinet-mailing', 'kabinet-mailing-test', 'calendar', 'simple')", nullable=true)
*/
private $type;
/**
* @var string
*
* @ORM\Column(name="locale", type="string", length=5)
*/
private $locale;
/**
* @ORM\ManyToOne(targetEntity="Notaris\AdminBundle\Entity\User")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $user;
/**
* @ORM\Column(name="to_group", type="string", columnDefinition="enum('N', 'N-SVEN-ADMIN', 'N-WITH-SVEN', 'N-WITHOUT-SVEN', 'S', '0', 'ER')", nullable=true)
*/
private $toGroup;
/**
* @var string
*
* @ORM\Column(name="from_name", type="string", length=255, nullable=true)
*/
private $fromName;
/**
* @var string
*
* @ORM\Column(name="from_email", type="string", length=255)
*/
private $fromEmail;
/**
* @var string
*
* @ORM\Column(name="mailing_to", type="string", length=255, nullable=true)
*/
private $to;
/**
* @var string
*
* @ORM\Column(name="mailing_cc", type="string", length=255, nullable=true)
*/
private $cc;
/**
* @var string
*
* @ORM\Column(name="mail_subject", type="string", length=255, nullable=true)
*/
private $mailSubject;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=255, nullable=true)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="number", type="integer", length=255, nullable=true)
*/
private $number;
/**
* @var string
*
* @ORM\Column(name="number_notary", type="string", length=255, nullable=true)
*/
private $numberNotary;
/**
* @var string
*
* @ORM\Column(name="timerange", type="string", length=255, nullable=true)
*/
private $timerange;
/**
* @ORM\Column(type="text", name="description", nullable=true)
*/
private $description;
/**
* @ORM\OneToOne(targetEntity="Asset")
* @ORM\JoinColumn(name="asset_id", referencedColumnName="id")
*/
protected $asset;
/**
* @ORM\Column(type="text", name="html_body", nullable=true)
*/
private $htmlBody;
/**
* @ORM\Column(type="text", name="html_browser", nullable=true)
*/
private $htmlBrowser;
/**
* @ORM\OneToMany(targetEntity="Notaris\AdminBundle\Entity\MailingTo", mappedBy="mailing")
*/
private $mails;
/**
* @ORM\Column(name="date_ready_to_send", type="datetime", nullable=true)
*/
private $dateReadyToSend;
/**
* @ORM\Column(name="date_in_queue", type="datetime", nullable=true)
*/
private $dateInQueue;
/**
* @ORM\Column(type="simple_array", name="subgroups", nullable=true)
*/
protected $subgroups;
/**
* @ORM\Column(type="boolean", name="is_test")
* @Assert\Type("boolean")
*/
private $isTest;
/**
* @Gedmo\Slug(fields={"mailSubject","number","title"})
* @ORM\Column(length=128)
*/
private $slug;
/**
* @ORM\OneToMany(targetEntity="NewsMailing", mappedBy="mailing")
*/
private $news;
/**
* @ORM\OneToMany(targetEntity="ArticleMailing", mappedBy="mailing")
*/
private $articles;
/**
* @var string
*
* @ORM\Column(name="attachments", type="json", nullable=true)
*/
private $attachments;
/**
* Constructor
*/
public function __construct()
{
$this->mails = new ArrayCollection();
$this->isTest = false;
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set created
*
* @param \DateTime $created
* @return Mailing
*/
public function setCreated($created)
{
$this->created = $created;
return $this;
}
/**
* Get created
*
* @return \DateTime
*/
public function getCreated()
{
return $this->created;
}
/**
* Set type
*
* @param string $type
* @return Mailing
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* Set locale
*
* @param string $locale
* @return Mailing
*/
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
/**
* Get locale
*
* @return string
*/
public function getLocale()
{
return $this->locale;
}
/**
* Set toGroup
*
* @param string $toGroup
* @return Mailing
*/
public function setToGroup($toGroup)
{
$this->toGroup = $toGroup;
return $this;
}
/**
* Get toGroup
*
* @return string
*/
public function getToGroup()
{
return $this->toGroup;
}
/**
* Set fromName
*
* @param string $fromName
* @return Mailing
*/
public function setFromName($fromName)
{
$this->fromName = $fromName;
return $this;
}
/**
* Get fromName
*
* @return string
*/
public function getFromName()
{
return $this->fromName;
}
/**
* Set fromEmail
*
* @param string $fromEmail
* @return Mailing
*/
public function setFromEmail($fromEmail)
{
$this->fromEmail = $fromEmail;
return $this;
}
/**
* Get fromEmail
*
* @return string
*/
public function getFromEmail()
{
return $this->fromEmail;
}
/**
* Set to
*
* @param string $to
* @return Mailing
*/
public function setTo($to)
{
$this->to = $to;
return $this;
}
/**
* Get to
*
* @return string
*/
public function getTo()
{
return $this->to;
}
/**
* @return string
*/
public function getMailSubject()
{
return $this->mailSubject;
}
/**
* Set title
*
* @param string $title
* @return Mailing
*/
public function setMailSubject($mailSubject)
{
$this->mailSubject = $mailSubject;
return $this;
}
/**
* Set title
*
* @param string $title
* @return Mailing
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set description
*
* @param string $description
* @return Mailing
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set htmlBody
*
* @param string $htmlBody
* @return Mailing
*/
public function setHtmlBody($htmlBody)
{
$this->htmlBody = $htmlBody;
return $this;
}
/**
* Get htmlBody
*
* @return string
*/
public function getHtmlBody()
{
return $this->htmlBody;
}
/**
* Set user
*
* @param \Notaris\AdminBundle\Entity\User $user
* @return Mailing
*/
public function setUser(\Notaris\AdminBundle\Entity\User $user = null)
{
$this->user = $user;
return $this;
}
/**
* Get user
*
* @return \Notaris\AdminBundle\Entity\User
*/
public function getUser()
{
return $this->user;
}
/**
* Set asset
*
* @param \Notaris\AdminBundle\Entity\Asset $asset
* @return Mailing
*/
public function setAsset(\Notaris\AdminBundle\Entity\Asset $asset = null)
{
$this->asset = $asset;
return $this;
}
/**
* Get asset
*
* @return \Notaris\AdminBundle\Entity\Asset
*/
public function getAsset()
{
return $this->asset;
}
/**
* Set htmlBrowser
*
* @param string $htmlBrowser
*
* @return Mailing
*/
public function setHtmlBrowser($htmlBrowser)
{
$this->htmlBrowser = $htmlBrowser;
return $this;
}
/**
* Get htmlBrowser
*
* @return string
*/
public function getHtmlBrowser()
{
return $this->htmlBrowser;
}
/**
* Add mail
*
* @param \Notaris\AdminBundle\Entity\MailingTo $mail
*
* @return Mailing
*/
public function addMail(\Notaris\AdminBundle\Entity\MailingTo $mail)
{
$this->mails[] = $mail;
return $this;
}
/**
* Remove mail
*
* @param \Notaris\AdminBundle\Entity\MailingTo $mail
*/
public function removeMail(\Notaris\AdminBundle\Entity\MailingTo $mail)
{
$this->mails->removeElement($mail);
}
/**
* Get mails
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getMails()
{
return $this->mails;
}
/**
* Set dateReadyToSend
*
* @param \DateTime $dateReadyToSend
*
* @return Mailing
*/
public function setDateReadyToSend($dateReadyToSend)
{
$this->dateReadyToSend = $dateReadyToSend;
return $this;
}
/**
* Get dateReadyToSend
*
* @return \DateTime
*/
public function getDateReadyToSend()
{
return $this->dateReadyToSend;
}
/**
* Set subgroups
*
* @param array $subgroups
*
* @return Mailing
*/
public function setSubgroups($subgroups)
{
$this->subgroups = $subgroups;
return $this;
}
/**
* Get subgroups
*
* @return array
*/
public function getSubgroups()
{
return $this->subgroups;
}
/**
* Set isTest
*
* @param boolean $isTest
*
* @return Mailing
*/
public function setIsTest($isTest)
{
$this->isTest = $isTest;
return $this;
}
/**
* Get isTest
*
* @return boolean
*/
public function getIsTest()
{
return $this->isTest;
}
/**
* Set dateInQueue
*
* @param \DateTime $dateInQueue
*
* @return Mailing
*/
public function setDateInQueue($dateInQueue)
{
$this->dateInQueue = $dateInQueue;
return $this;
}
/**
* Get dateInQueue
*
* @return \DateTime
*/
public function getDateInQueue()
{
return $this->dateInQueue;
}
/**
* Set timerange
*
* @param string $timerange
*
* @return Mailing
*/
public function setTimerange($timerange)
{
$this->timerange = $timerange;
return $this;
}
/**
* Get timerange
*
* @return string
*/
public function getTimerange()
{
return $this->timerange;
}
/**
* Set number
*
* @param integer $number
*
* @return Mailing
*/
public function setNumber($number)
{
$this->number = $number;
return $this;
}
/**
* Get number
*
* @return integer
*/
public function getNumber()
{
return $this->number;
}
/**
* Set slug
*
* @param string $slug
*
* @return Mailing
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Add news
*
* @param \Notaris\AdminBundle\Entity\NewsMailing $news
*
* @return Mailing
*/
public function addNews(\Notaris\AdminBundle\Entity\NewsMailing $news)
{
$this->news[] = $news;
return $this;
}
/**
* Remove news
*
* @param \Notaris\AdminBundle\Entity\NewsMailing $news
*/
public function removeNews(\Notaris\AdminBundle\Entity\NewsMailing $news)
{
$this->news->removeElement($news);
}
/**
* Get news
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getNews()
{
return $this->news;
}
/**
* Add article
*
* @param \Notaris\AdminBundle\Entity\Article $article
*
* @return Mailing
*/
public function addArticle(\Notaris\AdminBundle\Entity\Article $article)
{
$this->articles[] = $article;
return $this;
}
/**
* Remove article
*
* @param \Notaris\AdminBundle\Entity\Article $article
*/
public function removeArticle(\Notaris\AdminBundle\Entity\Article $article)
{
$this->articles->removeElement($article);
}
/**
* Get articles
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getArticles()
{
return $this->articles;
}
/**
* Set numberNotary
*
* @param string $numberNotary
*
* @return Mailing
*/
public function setNumberNotary($numberNotary)
{
$this->numberNotary = $numberNotary;
return $this;
}
/**
* Get numberNotary
*
* @return string
*/
public function getNumberNotary()
{
return $this->numberNotary;
}
/**
* Set cc
*
* @param string $cc
*
* @return Mailing
*/
public function setCc($cc)
{
$this->cc = $cc;
return $this;
}
/**
* Get cc
*
* @return string
*/
public function getCc()
{
return $this->cc;
}
/**
* Set attachments
*
* @param array $attachments
*
* @return Mailing
*/
public function setAttachments($attachments)
{
$this->attachments = $attachments;
return $this;
}
/**
* Get attachments
*
* @return array
*/
public function getAttachments()
{
return $this->attachments;
}
}