| 1: | <?php |
| 2: | namespace TIC\MailBundle\Entity; |
| 3: | |
| 4: | use Doctrine\ORM\Mapping as ORM; |
| 5: | use Symfony\Component\Validator\Constraints as Assert; |
| 6: | |
| 7: | /** |
| 8: | * Entité annexe contenant les traductions pour les notifications. |
| 9: | * @ORM\Table(name="tic_mail_template_translation") |
| 10: | * @ORM\Entity() |
| 11: | * @ORM\HasLifecycleCallbacks |
| 12: | */ |
| 13: | class TemplateTranslation |
| 14: | { |
| 15: | use \TIC\DormBundle\Traits\EntityTimestampable; // require @ORM\HasLifecycleCallbacks |
| 16: | |
| 17: | |
| 18: | // --------------------------------------------------------------------- Properties |
| 19: | |
| 20: | /** |
| 21: | * @ORM\Column(type="integer") |
| 22: | * @ORM\GeneratedValue(strategy="AUTO") |
| 23: | * @ORM\Id |
| 24: | */ |
| 25: | private $id; |
| 26: | |
| 27: | /** |
| 28: | * @ORM\ManyToOne(targetEntity="Template", inversedBy="translations") |
| 29: | * @ORM\JoinColumn(name="master_ref", referencedColumnName="ref", nullable=false) |
| 30: | */ |
| 31: | private $master; |
| 32: | |
| 33: | /** |
| 34: | * @ORM\Column(type="string", length=10) |
| 35: | * @Assert\NotBlank() |
| 36: | */ |
| 37: | private $locale; |
| 38: | |
| 39: | /** |
| 40: | * @ORM\Column(type="string", length=250, nullable=true) |
| 41: | */ |
| 42: | private $subject; |
| 43: | |
| 44: | /** |
| 45: | * @ORM\Column(type="text", nullable=true) |
| 46: | */ |
| 47: | private $bodyText; |
| 48: | |
| 49: | /** |
| 50: | * @ORM\Column(type="text", nullable=true) |
| 51: | */ |
| 52: | private $bodyHtml; |
| 53: | |
| 54: | /** |
| 55: | * @ORM\Column(type="text", nullable=true) |
| 56: | */ |
| 57: | private $bodySms; |
| 58: | |
| 59: | |
| 60: | // --------------------------------------------------------------------- Custom methods |
| 61: | |
| 62: | public function __construct() |
| 63: | { |
| 64: | } |
| 65: | |
| 66: | public function __toString() |
| 67: | { |
| 68: | return sprintf('%s [%s]', $this->master->getRef(), $this->locale); |
| 69: | } |
| 70: | |
| 71: | |
| 72: | // --------------------------------------------------------------------- Auto-generated |
| 73: | |
| 74: | /** |
| 75: | * Get id |
| 76: | * |
| 77: | * @return integer |
| 78: | */ |
| 79: | public function getId() |
| 80: | { |
| 81: | return $this->id; |
| 82: | } |
| 83: | |
| 84: | /** |
| 85: | * Set locale |
| 86: | * |
| 87: | * @param string $locale |
| 88: | * |
| 89: | * @return TemplateTranslation |
| 90: | */ |
| 91: | public function setLocale($locale) |
| 92: | { |
| 93: | $this->locale = $locale; |
| 94: | |
| 95: | return $this; |
| 96: | } |
| 97: | |
| 98: | /** |
| 99: | * Get locale |
| 100: | * |
| 101: | * @return string |
| 102: | */ |
| 103: | public function getLocale() |
| 104: | { |
| 105: | return $this->locale; |
| 106: | } |
| 107: | |
| 108: | /** |
| 109: | * Set subject |
| 110: | * |
| 111: | * @param string $subject |
| 112: | * |
| 113: | * @return TemplateTranslation |
| 114: | */ |
| 115: | public function setSubject($subject) |
| 116: | { |
| 117: | $this->subject = $subject; |
| 118: | |
| 119: | return $this; |
| 120: | } |
| 121: | |
| 122: | /** |
| 123: | * Get subject |
| 124: | * |
| 125: | * @return string |
| 126: | */ |
| 127: | public function getSubject() |
| 128: | { |
| 129: | return $this->subject; |
| 130: | } |
| 131: | |
| 132: | /** |
| 133: | * Set bodyText |
| 134: | * |
| 135: | * @param string $bodyText |
| 136: | * |
| 137: | * @return TemplateTranslation |
| 138: | */ |
| 139: | public function setBodyText($bodyText) |
| 140: | { |
| 141: | $this->bodyText = $bodyText; |
| 142: | |
| 143: | return $this; |
| 144: | } |
| 145: | |
| 146: | /** |
| 147: | * Get bodyText |
| 148: | * |
| 149: | * @return string |
| 150: | */ |
| 151: | public function getBodyText() |
| 152: | { |
| 153: | return $this->bodyText; |
| 154: | } |
| 155: | |
| 156: | /** |
| 157: | * Set bodyHtml |
| 158: | * |
| 159: | * @param string $bodyHtml |
| 160: | * |
| 161: | * @return TemplateTranslation |
| 162: | */ |
| 163: | public function setBodyHtml($bodyHtml) |
| 164: | { |
| 165: | $this->bodyHtml = $bodyHtml; |
| 166: | |
| 167: | return $this; |
| 168: | } |
| 169: | |
| 170: | /** |
| 171: | * Get bodyHtml |
| 172: | * |
| 173: | * @return string |
| 174: | */ |
| 175: | public function getBodyHtml() |
| 176: | { |
| 177: | return $this->bodyHtml; |
| 178: | } |
| 179: | |
| 180: | /** |
| 181: | * Set bodySms |
| 182: | * |
| 183: | * @param string $bodySms |
| 184: | * |
| 185: | * @return TemplateTranslation |
| 186: | */ |
| 187: | public function setBodySms($bodySms) |
| 188: | { |
| 189: | $this->bodySms = $bodySms; |
| 190: | |
| 191: | return $this; |
| 192: | } |
| 193: | |
| 194: | /** |
| 195: | * Get bodySms |
| 196: | * |
| 197: | * @return string |
| 198: | */ |
| 199: | public function getBodySms() |
| 200: | { |
| 201: | return $this->bodySms; |
| 202: | } |
| 203: | |
| 204: | /** |
| 205: | * Set master |
| 206: | * |
| 207: | * @param Template $master |
| 208: | * |
| 209: | * @return TemplateTranslation |
| 210: | */ |
| 211: | public function setMaster(Template $master = null) |
| 212: | { |
| 213: | $this->master = $master; |
| 214: | |
| 215: | return $this; |
| 216: | } |
| 217: | |
| 218: | /** |
| 219: | * Get master |
| 220: | * |
| 221: | * @return Template |
| 222: | */ |
| 223: | public function getMaster() |
| 224: | { |
| 225: | return $this->master; |
| 226: | } |
| 227: | } |
| 228: |