Add listener for updating lastSubscribedAt
[MAILPOET-3031]
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
namespace MailPoet\Doctrine;
|
||||
|
||||
use MailPoet\Doctrine\EventListeners\EmojiEncodingListener;
|
||||
use MailPoet\Doctrine\EventListeners\LastSubscribedAtListener;
|
||||
use MailPoet\Doctrine\EventListeners\TimestampListener;
|
||||
use MailPoet\Doctrine\EventListeners\ValidationListener;
|
||||
use MailPoet\Tracy\DoctrinePanel\DoctrinePanel;
|
||||
@ -29,18 +30,23 @@ class EntityManagerFactory {
|
||||
/** @var EmojiEncodingListener */
|
||||
private $emojiEncodingListener;
|
||||
|
||||
/** @var LastSubscribedAtListener */
|
||||
private $lastSubscribedAtListener;
|
||||
|
||||
public function __construct(
|
||||
Connection $connection,
|
||||
Configuration $configuration,
|
||||
TimestampListener $timestampListener,
|
||||
ValidationListener $validationListener,
|
||||
EmojiEncodingListener $emojiEncodingListener
|
||||
EmojiEncodingListener $emojiEncodingListener,
|
||||
LastSubscribedAtListener $lastSubscribedAtListener
|
||||
) {
|
||||
$this->connection = $connection;
|
||||
$this->configuration = $configuration;
|
||||
$this->timestampListener = $timestampListener;
|
||||
$this->validationListener = $validationListener;
|
||||
$this->emojiEncodingListener = $emojiEncodingListener;
|
||||
$this->lastSubscribedAtListener = $lastSubscribedAtListener;
|
||||
}
|
||||
|
||||
public function createEntityManager() {
|
||||
@ -67,5 +73,10 @@ class EntityManagerFactory {
|
||||
[Events::prePersist, Events::preUpdate],
|
||||
$this->emojiEncodingListener
|
||||
);
|
||||
|
||||
$entityManager->getEventManager()->addEventListener(
|
||||
[Events::prePersist, Events::preUpdate],
|
||||
$this->lastSubscribedAtListener
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user