From 287d3a6c403d1ce14c7bee166af575f5aaba7e0d Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 23 Sep 2019 15:21:27 +0200 Subject: [PATCH 1/7] Nette 3.0 v composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index d4fcb3c..9c4cd9e 100644 --- a/composer.json +++ b/composer.json @@ -11,9 +11,9 @@ ], "minimum-stability": "stable", "require": { - "nette/mail": "^2.3", + "nette/mail": "^2.3 || ~3.0", "kdyby/doctrine": "^3.0", - "nette/di": "^2.3", + "nette/di": "^2.3 || ~3.0", "tracy/tracy": "^2.3", "adt/background-queue": "^3.12" }, From cfa89ed85d2c86bd72f9355ca18251d75f1e56da Mon Sep 17 00:00:00 2001 From: Nicolas Date: Wed, 25 Sep 2019 09:57:20 +0200 Subject: [PATCH 2/7] Kdyby/Doctrine 4.0 v composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9c4cd9e..c611b0c 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "minimum-stability": "stable", "require": { "nette/mail": "^2.3 || ~3.0", - "kdyby/doctrine": "^3.0", + "kdyby/doctrine": "^3.0 || ^4.0", "nette/di": "^2.3 || ~3.0", "tracy/tracy": "^2.3", "adt/background-queue": "^3.12" From 20a9730dfc7e0a71a01a6230755e05ed6e94b4cb Mon Sep 17 00:00:00 2001 From: Nicolas Date: Wed, 2 Oct 2019 14:22:24 +0200 Subject: [PATCH 3/7] Use Kdyby/DoctrineMagicAccessors --- composer.json | 1 + src/Entity/AbstractMailQueueEntry.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c611b0c..ef16bbd 100644 --- a/composer.json +++ b/composer.json @@ -13,6 +13,7 @@ "require": { "nette/mail": "^2.3 || ~3.0", "kdyby/doctrine": "^3.0 || ^4.0", + "kdyby/doctrine-magic-accessors": "^1.0", "nette/di": "^2.3 || ~3.0", "tracy/tracy": "^2.3", "adt/background-queue": "^3.12" diff --git a/src/Entity/AbstractMailQueueEntry.php b/src/Entity/AbstractMailQueueEntry.php index 2fef39c..8a5b008 100644 --- a/src/Entity/AbstractMailQueueEntry.php +++ b/src/Entity/AbstractMailQueueEntry.php @@ -14,7 +14,7 @@ * @property \Nette\Mail\Message|NULL $message */ abstract class AbstractMailQueueEntry { - use \Kdyby\Doctrine\Entities\MagicAccessors; + use \Kdyby\Doctrine\MagicAccessors\MagicAccessors; /** * @ORM\Column(type="datetime") From 20b5f80b9a879422aa62b14062ec4ea3bc80436c Mon Sep 17 00:00:00 2001 From: Nicolas Date: Wed, 2 Oct 2019 14:35:06 +0200 Subject: [PATCH 4/7] Update of QueueMailer return type + Update of dependencies (broken backwards compatibility) --- composer.json | 3 ++- src/Service/QueueMailer.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index ef16bbd..2ea5530 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,8 @@ ], "minimum-stability": "stable", "require": { - "nette/mail": "^2.3 || ~3.0", + "php": "^7.1", + "nette/mail": "~3.0", "kdyby/doctrine": "^3.0 || ^4.0", "kdyby/doctrine-magic-accessors": "^1.0", "nette/di": "^2.3 || ~3.0", diff --git a/src/Service/QueueMailer.php b/src/Service/QueueMailer.php index d621a7a..0bd9b8a 100644 --- a/src/Service/QueueMailer.php +++ b/src/Service/QueueMailer.php @@ -11,7 +11,7 @@ public function __construct(QueueService $queueService) { $this->queueService = $queueService; } - public function send(\Nette\Mail\Message $mail) { + public function send(\Nette\Mail\Message $mail): void { $this->queueService->enqueue($mail); } From 29c1993be0307e0b4f8f876a9a2cd21e9d2e6be3 Mon Sep 17 00:00:00 2001 From: Ivo Toman Date: Sat, 15 Feb 2020 07:31:03 +0100 Subject: [PATCH 5/7] Remove kdyby/doctrine --- composer.json | 1 - src/Entity/MailQueueEntry.php | 4 ++-- src/Service/QueueService.php | 9 +++++---- src/Traits/Identifier.php | 28 ++++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 src/Traits/Identifier.php diff --git a/composer.json b/composer.json index 2ea5530..fb38285 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,6 @@ "require": { "php": "^7.1", "nette/mail": "~3.0", - "kdyby/doctrine": "^3.0 || ^4.0", "kdyby/doctrine-magic-accessors": "^1.0", "nette/di": "^2.3 || ~3.0", "tracy/tracy": "^2.3", diff --git a/src/Entity/MailQueueEntry.php b/src/Entity/MailQueueEntry.php index 1ca0a3b..0a9efb3 100644 --- a/src/Entity/MailQueueEntry.php +++ b/src/Entity/MailQueueEntry.php @@ -9,5 +9,5 @@ * @ORM\Entity */ class MailQueueEntry extends AbstractMailQueueEntry { - use \Kdyby\Doctrine\Entities\Attributes\Identifier; -} \ No newline at end of file + use \ADT\MailQueue\Traits\Identifier; +} diff --git a/src/Service/QueueService.php b/src/Service/QueueService.php index c730079..5d52e76 100644 --- a/src/Service/QueueService.php +++ b/src/Service/QueueService.php @@ -3,6 +3,7 @@ namespace ADT\MailQueue\Service; use ADT\MailQueue\Entity; +use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -10,7 +11,7 @@ * @method onQueueDrained(OutputInterface|NULL $output) */ class QueueService { - + use \Nette\SmartObject; const MUTEX_TIME_FORMAT = DATE_W3C; @@ -56,11 +57,11 @@ class QueueService { /** @var string */ protected $backgroundQueueCallbackName; - public function __construct($config, \Kdyby\Doctrine\EntityManager $em) { + public function __construct($config, EntityManagerInterface $em) { if (! is_dir($config['tempDir'])) { - mkdir($config['tempDir']); + mkdir($config['tempDir']); } - + $this->mutexFile = 'nette.safe://' . $config['tempDir'] . '/adt-mail-queue.lock'; $this->mutexTimeFile = 'nette.safe://' . $config['tempDir'] . '/adt-mail-queue.lock.timestamp'; diff --git a/src/Traits/Identifier.php b/src/Traits/Identifier.php new file mode 100644 index 0000000..654bce4 --- /dev/null +++ b/src/Traits/Identifier.php @@ -0,0 +1,28 @@ +id; + } + + public function __clone() + { + $this->id = NULL; + } +} From 9149cff52e60c2816be1156efeb3d81b40986c5e Mon Sep 17 00:00:00 2001 From: Ivo Toman Date: Tue, 24 Mar 2020 20:41:52 +0100 Subject: [PATCH 6/7] add command name --- src/Console/ProcessCommand.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Console/ProcessCommand.php b/src/Console/ProcessCommand.php index c8aa5c7..8452a3d 100644 --- a/src/Console/ProcessCommand.php +++ b/src/Console/ProcessCommand.php @@ -10,6 +10,9 @@ class ProcessCommand extends Command { + + protected static $defaultName = 'mail-queue:process'; + /** * {@inheritdoc} */ From 4283a4d7242cf0c0168d45b3ec069952239a2b45 Mon Sep 17 00:00:00 2001 From: Viktor Masicek Date: Fri, 19 Jun 2020 17:45:31 +0200 Subject: [PATCH 7/7] Remove depending on Kdyby/DoctrineMagicAccessors --- composer.json | 1 - src/Entity/AbstractMailQueueEntry.php | 69 ++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index fb38285..78d27c0 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,6 @@ "require": { "php": "^7.1", "nette/mail": "~3.0", - "kdyby/doctrine-magic-accessors": "^1.0", "nette/di": "^2.3 || ~3.0", "tracy/tracy": "^2.3", "adt/background-queue": "^3.12" diff --git a/src/Entity/AbstractMailQueueEntry.php b/src/Entity/AbstractMailQueueEntry.php index 8a5b008..1628476 100644 --- a/src/Entity/AbstractMailQueueEntry.php +++ b/src/Entity/AbstractMailQueueEntry.php @@ -14,7 +14,6 @@ * @property \Nette\Mail\Message|NULL $message */ abstract class AbstractMailQueueEntry { - use \Kdyby\Doctrine\MagicAccessors\MagicAccessors; /** * @ORM\Column(type="datetime") @@ -58,7 +57,7 @@ public function getMessage() { * @param \Nette\Mail\Message|NULL $message * @return $this */ - public function setMessage(\Nette\Mail\Message $message = NULL) { + public function setMessage(\Nette\Mail\Message $message = NULL): self { if ($message === NULL) { $this->message = NULL; } else { @@ -71,4 +70,70 @@ public function setMessage(\Nette\Mail\Message $message = NULL) { * @return mixed|NULL */ abstract public function getId(); + + + /** + * @return \DateTime + */ + public function getCreatedAt(): \DateTime { + return $this->createdAt; + } + + /** + * @param \DateTime $createdAt + * @return AbstractMailQueueEntry + */ + public function setCreatedAt(\DateTime $createdAt): self { + $this->createdAt = $createdAt; + return $this; + } + + /** + * @return \DateTime|NULL + */ + public function getSentAt(): ?\DateTime { + return $this->sentAt; + } + + /** + * @param \DateTime|NULL $sentAt + * @return AbstractMailQueueEntry + */ + public function setSentAt(?\DateTime $sentAt): self { + $this->sentAt = $sentAt; + return $this; + } + + /** + * @return string + */ + public function getFrom(): string { + return $this->from; + } + + /** + * @param string $from + * @return AbstractMailQueueEntry + */ + public function setFrom(string $from): self { + $this->from = $from; + return $this; + } + + /** + * @return string + */ + public function getSubject(): string { + return $this->subject; + } + + /** + * @param string $subject + * @return AbstractMailQueueEntry + */ + public function setSubject(string $subject): self { + $this->subject = $subject; + return $this; + } + }