src/Entity/SmsSpotHitCampain.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Interfaces\SpotHitCampainInterface;
  4. use App\Traits\DateTrait;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9. * @ORM\Entity
  10. *
  11. * @ORM\Table(uniqueConstraints={
  12. * @ORM\UniqueConstraint(columns={"nom"})
  13. * })
  14. * @UniqueEntity(fields={"nom"})
  15. */
  16. class SmsSpotHitCampain implements SpotHitCampainInterface
  17. {
  18. use DateTrait;
  19. /**
  20. * @var int|null
  21. *
  22. * @ORM\Column(type="integer")
  23. * @ORM\Id
  24. * @ORM\GeneratedValue(strategy="AUTO")
  25. */
  26. protected ?int $id = null;
  27. /**
  28. * @var integer|null
  29. *
  30. * @ORM\Column(type="integer", nullable=true)
  31. *
  32. * @Assert\GreaterThanOrEqual(value = 1)
  33. * @Assert\Type(type="integer")
  34. */
  35. protected ?int $idSpotHit = null;
  36. /**
  37. * @var string
  38. *
  39. * @ORM\Column(type="string")
  40. *
  41. * @Assert\NotBlank
  42. * @Assert\Type(type="string")
  43. *
  44. */
  45. protected string $message = '';
  46. /**
  47. * @var array|string[]
  48. *
  49. * @ORM\Column(type="json")
  50. *
  51. * @Assert\All({
  52. * @Assert\Type(type="string"),
  53. * })
  54. *
  55. * @Assert\NotBlank
  56. */
  57. protected array $destinataires = [];
  58. /**
  59. * @var string|null
  60. *
  61. * Si vide, l'expéditeur du SMS sera un numéro court à 5 chiffres auxquels les destinataires peuvent répondre
  62. *
  63. * @ORM\Column(type="string", length=11, nullable=true)
  64. *
  65. * @Assert\Length(min=1, max=11)
  66. * @Assert\Type(type="string")
  67. */
  68. protected ?string $expediteur = null;
  69. /**
  70. * @var \DateTime|null
  71. *
  72. * @ORM\Column(type="datetime", nullable=true)
  73. *
  74. * @Assert\Type(type="\DateTime")
  75. */
  76. protected ?\DateTime $date = null;
  77. /**
  78. * @var boolean
  79. *
  80. * Si true, autorise l'envoi de SMS supérieur à 160 caractères
  81. *
  82. * @ORM\Column(type="boolean")
  83. * @Assert\Type(type="bool")
  84. */
  85. protected bool $smslong = true;
  86. /**
  87. * @var integer|null
  88. *
  89. * Permet de vérifier la taille du SMS long envoyé. Doit correspondre au nombre de caractères su sms, Si le compteur spothit indique un nombre différent, le message sera rejeté.
  90. *
  91. * @ORM\Column(type="integer", nullable=true)
  92. *
  93. * @Assert\GreaterThanOrEqual(value = 1)
  94. * @Assert\Type(type="integer")
  95. */
  96. protected ?int $smslongnbr = null;
  97. /**
  98. * @var boolean
  99. *
  100. * Si true, tronque automatiquement le message à 160 caractères.
  101. *
  102. * @ORM\Column(type="boolean")
  103. * @Assert\Type(type="bool")
  104. */
  105. protected bool $tronque = false;
  106. /**
  107. * @var string|null
  108. *
  109. * "auto" => UTF8, "ucs2" => unicode
  110. *
  111. * @ORM\Column(type="string", nullable=true)
  112. *
  113. * @Assert\Choice({"auto", "ucs2", null})
  114. * @Assert\Type(type="string")
  115. */
  116. protected ?string $encodage = null;
  117. /**
  118. * @var string|null
  119. *
  120. * nom de la campagne
  121. *
  122. * @ORM\Column(type="string", nullable=true)
  123. *
  124. * @Assert\Length(min=1, max=50)
  125. * @Assert\Type(type="string")
  126. */
  127. protected ?string $nom = null;
  128. /**
  129. * @var string|null
  130. *
  131. * "all" => sélection de tous les contacts du compte
  132. * "groupe" => sélection de tous les contacts des groupes fournis dans le champ « destinataires »
  133. * "datas" => permet d'ajouter des données personnalisées aux « destinataires » pour les utiliser dans votre message (exemple : "Bonjour {nom} {prenom}")
  134. * il faut que le champ « destinataires » soit un tableau de cette forme : ["+33600000001" => ["nom" => "Nom 1", "prenom" => "Prénom 1"], "+33600000002" => ["nom" => "Nom 2", "prenom" => "Prénom 2"] ...]
  135. *
  136. * @ORM\Column(type="string", nullable=true)
  137. *
  138. * @Assert\Choice({"all", "groupe", "datas", null})
  139. * @Assert\Type(type="string")
  140. */
  141. protected ?string $destinatairesType = 'datas';
  142. /**
  143. * @var string|null
  144. *
  145. * Adresse URL de votre serveur pour la réception en "push" des statuts après l'envoi.
  146. * Vous devez déjà avoir une adresse paramétrée sur votre compte pour activer les retours "push".
  147. * Si ce paramètre est renseigné, cette URL sera appelée pour cet envoi sinon l'adresse du compte est utilisée.
  148. *
  149. * @ORM\Column(type="string", nullable=true)
  150. *
  151. * @Assert\Type(type="string")
  152. */
  153. protected ?string $url = null;
  154. /**
  155. * @var \DateTime|null
  156. *
  157. * Obligatoire pour l'envoi échelonné
  158. *
  159. * @ORM\Column(type="datetime", nullable=true)
  160. *
  161. * @Assert\Type(type="\DateTime")
  162. */
  163. protected ?\DateTime $dateDebut = null;
  164. /**
  165. * @var \DateTime|null
  166. *
  167. * Obligatoire pour l'envoi échelonné
  168. *
  169. * @ORM\Column(type="datetime", nullable=true)
  170. *
  171. * @Assert\Type(type="\DateTime")
  172. */
  173. protected ?\DateTime $dateFin = null;
  174. /**
  175. * @var array|int[]|null
  176. *
  177. * Obligatoire pour l'envoi échelonné
  178. * Heure(s) d'envois (du lundi au samedi de 8h00 à 22h00 hors jours fériés)
  179. * Tableau avec 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
  180. * La campagne sera fractionnée proportionnellement aux nombres de créneaux entre le jour et l'heure de démarrage, et le jour et l'heure de fin souhaitée.
  181. *
  182. * @ORM\Column(type="json", nullable=true)
  183. *
  184. * @Assert\All({
  185. * @Assert\Type(type="int"),
  186. * })
  187. *
  188. * @Assert\NotBlank(allowNull=true)
  189. */
  190. protected ?array $creneaux = null;
  191. /**
  192. * @var integer|null
  193. *
  194. * Obligatoire pour l'envoi échelonné
  195. * 1,2,3,4 ou 6
  196. * Nombre d'envoi(s) par heure
  197. *
  198. * @ORM\Column(type="integer", nullable=true)
  199. *
  200. * @Assert\Choice({1, 2, 3, 4, 6})
  201. * @Assert\Type(type="integer")
  202. */
  203. protected ?int $creneauxHeure = null;
  204. /**
  205. * @var integer|null
  206. *
  207. * Obligatoire pour l'envoi échelonné
  208. * Tableau avec 1,2,3,4,5,6
  209. * Jours d'envoi (1 représentant lundi). Pas d'envoi le dimanche.
  210. *
  211. * @ORM\Column(type="integer", nullable=true)
  212. *
  213. * @Assert\Length(min=1, max=6)
  214. * @Assert\Type(type="integer")
  215. */
  216. protected ?int $jours = null;
  217. /**
  218. * @var string|null
  219. *
  220. * Fuseau horaire
  221. *
  222. * @ORM\Column(type="string", nullable=true)
  223. *
  224. * @Assert\Type(type="string")
  225. */
  226. protected ?string $timezone = null;
  227. /**
  228. * @return int|null
  229. */
  230. public function getId(): ?int
  231. {
  232. return $this->id;
  233. }
  234. /**
  235. * @return string
  236. */
  237. public function getMessage(): string
  238. {
  239. return $this->message;
  240. }
  241. /**
  242. * @param string $message
  243. *
  244. * @return $this
  245. */
  246. public function setMessage(string $message): SmsSpotHitCampain
  247. {
  248. $this->message = $message;
  249. return $this;
  250. }
  251. /**
  252. * @return array|string[]
  253. */
  254. public function getDestinataires(): array
  255. {
  256. return $this->destinataires;
  257. }
  258. /**
  259. * @param array $destinataires
  260. *
  261. * @return $this
  262. */
  263. public function setDestinataires(array $destinataires): SmsSpotHitCampain
  264. {
  265. $this->destinataires = $destinataires;
  266. return $this;
  267. }
  268. /**
  269. * @return string|null
  270. */
  271. public function getExpediteur(): ?string
  272. {
  273. return $this->expediteur;
  274. }
  275. /**
  276. * @param string|null $expediteur
  277. *
  278. * @return $this
  279. */
  280. public function setExpediteur(?string $expediteur): SmsSpotHitCampain
  281. {
  282. $this->expediteur = $expediteur;
  283. return $this;
  284. }
  285. /**
  286. * @return bool
  287. */
  288. public function isSmslong(): bool
  289. {
  290. return $this->smslong;
  291. }
  292. /**
  293. * @param bool $smslong
  294. *
  295. * @return $this
  296. */
  297. public function setSmslong(bool $smslong): SmsSpotHitCampain
  298. {
  299. $this->smslong = $smslong;
  300. return $this;
  301. }
  302. /**
  303. * @return int|null
  304. */
  305. public function getSmslongnbr(): ?int
  306. {
  307. return $this->smslongnbr;
  308. }
  309. /**
  310. * @param int|null $smslongnbr
  311. *
  312. * @return $this
  313. */
  314. public function setSmslongnbr(?int $smslongnbr): SmsSpotHitCampain
  315. {
  316. $this->smslongnbr = $smslongnbr;
  317. return $this;
  318. }
  319. /**
  320. * @return bool
  321. */
  322. public function isTronque(): bool
  323. {
  324. return $this->tronque;
  325. }
  326. /**
  327. * @param bool $tronque
  328. *
  329. * @return $this
  330. */
  331. public function setTronque(bool $tronque): SmsSpotHitCampain
  332. {
  333. $this->tronque = $tronque;
  334. return $this;
  335. }
  336. /**
  337. * @return string|null
  338. */
  339. public function getEncodage(): ?string
  340. {
  341. return $this->encodage;
  342. }
  343. /**
  344. * @param string|null $encodage
  345. *
  346. * @return $this
  347. */
  348. public function setEncodage(?string $encodage): SmsSpotHitCampain
  349. {
  350. $this->encodage = $encodage;
  351. return $this;
  352. }
  353. /**
  354. * @return string|null
  355. */
  356. public function getNom(): ?string
  357. {
  358. return $this->nom;
  359. }
  360. /**
  361. * @param string|null $nom
  362. *
  363. * @return $this
  364. */
  365. public function setNom(?string $nom): SmsSpotHitCampain
  366. {
  367. $this->nom = $nom;
  368. return $this;
  369. }
  370. /**
  371. * @return string|null
  372. */
  373. public function getDestinatairesType(): ?string
  374. {
  375. return $this->destinatairesType;
  376. }
  377. /**
  378. * @param string|null $destinatairesType
  379. *
  380. * @return $this
  381. */
  382. public function setDestinatairesType(?string $destinatairesType): SmsSpotHitCampain
  383. {
  384. $this->destinatairesType = $destinatairesType;
  385. return $this;
  386. }
  387. /**
  388. * @return string|null
  389. */
  390. public function getUrl(): ?string
  391. {
  392. return $this->url;
  393. }
  394. /**
  395. * @param string|null $url
  396. *
  397. * @return $this
  398. */
  399. public function setUrl(?string $url): SmsSpotHitCampain
  400. {
  401. $this->url = $url;
  402. return $this;
  403. }
  404. /**
  405. * @return array|int[]|null
  406. */
  407. public function getCreneaux(): ?array
  408. {
  409. return $this->creneaux;
  410. }
  411. /**
  412. * @param array|null $creneaux
  413. *
  414. * @return $this
  415. */
  416. public function setCreneaux(?array $creneaux): SmsSpotHitCampain
  417. {
  418. $this->creneaux = $creneaux;
  419. return $this;
  420. }
  421. /**
  422. * @return int|null
  423. */
  424. public function getCreneauxHeure(): ?int
  425. {
  426. return $this->creneauxHeure;
  427. }
  428. /**
  429. * @param int|null $creneauxHeure
  430. *
  431. * @return $this
  432. */
  433. public function setCreneauxHeure(?int $creneauxHeure): SmsSpotHitCampain
  434. {
  435. $this->creneauxHeure = $creneauxHeure;
  436. return $this;
  437. }
  438. /**
  439. * @return int|null
  440. */
  441. public function getJours(): ?int
  442. {
  443. return $this->jours;
  444. }
  445. /**
  446. * @param int|null $jours
  447. *
  448. * @return $this
  449. */
  450. public function setJours(?int $jours): SmsSpotHitCampain
  451. {
  452. $this->jours = $jours;
  453. return $this;
  454. }
  455. /**
  456. * @return string|null
  457. */
  458. public function getTimezone(): ?string
  459. {
  460. return $this->timezone;
  461. }
  462. /**
  463. * @param string|null $timezone
  464. *
  465. * @return $this
  466. */
  467. public function setTimezone(?string $timezone): SmsSpotHitCampain
  468. {
  469. $this->timezone = $timezone;
  470. return $this;
  471. }
  472. /**
  473. * @return \DateTime|null
  474. */
  475. public function getDate(): ?\DateTime
  476. {
  477. return $this->date;
  478. }
  479. /**
  480. * @param \DateTime|null $date
  481. *
  482. * @return $this
  483. */
  484. public function setDate(?\DateTime $date): SmsSpotHitCampain
  485. {
  486. $this->date = $date;
  487. return $this;
  488. }
  489. /**
  490. * @return \DateTime|null
  491. */
  492. public function getDateDebut(): ?\DateTime
  493. {
  494. return $this->dateDebut;
  495. }
  496. /**
  497. * @param \DateTime|null $dateDebut
  498. *
  499. * @return $this
  500. */
  501. public function setDateDebut(?\DateTime $dateDebut): SmsSpotHitCampain
  502. {
  503. $this->dateDebut = $dateDebut;
  504. return $this;
  505. }
  506. /**
  507. * @return \DateTime|null
  508. */
  509. public function getDateFin(): ?\DateTime
  510. {
  511. return $this->dateFin;
  512. }
  513. /**
  514. * @param \DateTime|null $dateFin
  515. *
  516. * @return $this
  517. */
  518. public function setDateFin(?\DateTime $dateFin): SmsSpotHitCampain
  519. {
  520. $this->dateFin = $dateFin;
  521. return $this;
  522. }
  523. /**
  524. * @return int|null
  525. */
  526. public function getIdSpotHit(): ?int
  527. {
  528. return $this->idSpotHit;
  529. }
  530. /**
  531. * @param int|null $idSpotHit
  532. *
  533. * @return $this
  534. */
  535. public function setIdSpotHit(?int $idSpotHit): SmsSpotHitCampain
  536. {
  537. $this->idSpotHit = $idSpotHit;
  538. return $this;
  539. }
  540. /**
  541. * @return string
  542. */
  543. public function getProduit(): string
  544. {
  545. return SpotHitCampainInterface::PRODUIT_SMS;
  546. }
  547. }