<?php
namespace App\Entity;
use Knp\DoctrineBehaviors\Contract\Entity\SoftDeletableInterface;
use Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletableTrait;
use Knp\DoctrineBehaviors\Model\Blameable\BlameableTrait;
use Knp\DoctrineBehaviors\Contract\Entity\BlameableInterface;
use Knp\DoctrineBehaviors\Model\Timestampable\TimestampableTrait;
use Knp\DoctrineBehaviors\Contract\Entity\TimestampableInterface;
/**
* @Doctrine\ORM\Mapping\Entity
* @Doctrine\ORM\Mapping\Table(name="email_template")
*/
class EmailTemplate implements BlameableInterface, TimestampableInterface, SoftDeletableInterface {
use BlameableTrait;
use TimestampableTrait;
use SoftDeletableTrait;
/**
* @Doctrine\ORM\Mapping\Id
* @Doctrine\ORM\Mapping\Column(type="integer")
* @Doctrine\ORM\Mapping\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* nazwa wyświetlana w select
* @Doctrine\ORM\Mapping\Column(type="string", length=255, nullable=false)
*/
protected $name;
/**
* temat
* @Doctrine\ORM\Mapping\Column(type="string", length=255, nullable=false)
*/
protected $subject;
/**
* treść
* @Doctrine\ORM\Mapping\Column(type="text", nullable=false)
*/
protected $content;
/**
* code_name - dla zapytań
* @Doctrine\ORM\Mapping\Column(type="string", length=255, nullable=false)
*/
protected $codeName;
/**
* Wyróżnienie tagów na niebiesko w podglądzie, zgodnie z taskiem 7952
* @param $tags
* @return mixed
*/
public function getPreviewContent($tags) {
$content = $this->getContent();
foreach ($tags as $tag) {
$content = str_replace('{'.$tag.'}', '<span style="color:#299bea;">{'.$tag.'}</span>', $content);
}
return $content;
}
public function getId()
{
return $this->id;
}
public function getSubject()
{
return $this->subject;
}
public function getContent()
{
return $this->content;
}
public function setSubject($subject)
{
$this->subject = $subject;
return $this;
}
public function setContent($content)
{
$this->content = $content;
return $this;
}
public function getName()
{
return $this->name;
}
public function setName($name)
{
$this->name = $name;
return $this;
}
public function getCodeName()
{
return $this->codeName;
}
public function setCodeName($codeName)
{
$this->codeName = $codeName;
return $this;
}
}