diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-11-03 16:22:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-03 16:22:07 +0100 |
commit | da4136557963018287cae61226e9006c3c741747 (patch) | |
tree | 6bf23c0d32f3780843798ae47c65377ae1ff961a /src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php | |
parent | 816c0940d142f8ec69bdd3f302c9751033cce7e2 (diff) | |
parent | ca08d02f2f17c0e4ec0152a701c540f62713a428 (diff) | |
download | wallabag-da4136557963018287cae61226e9006c3c741747.tar.gz wallabag-da4136557963018287cae61226e9006c3c741747.tar.zst wallabag-da4136557963018287cae61226e9006c3c741747.zip |
Merge pull request #2180 from wallabag/download-pictures
Download pictures
Diffstat (limited to 'src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php b/src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php index b893ea29..aa7ff914 100644 --- a/src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php +++ b/src/Wallabag/ImportBundle/Consumer/AbstractConsumer.php | |||
@@ -9,6 +9,8 @@ use Wallabag\CoreBundle\Entity\Entry; | |||
9 | use Wallabag\CoreBundle\Entity\Tag; | 9 | use Wallabag\CoreBundle\Entity\Tag; |
10 | use Psr\Log\LoggerInterface; | 10 | use Psr\Log\LoggerInterface; |
11 | use Psr\Log\NullLogger; | 11 | use Psr\Log\NullLogger; |
12 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; | ||
13 | use Wallabag\CoreBundle\Event\EntrySavedEvent; | ||
12 | 14 | ||
13 | abstract class AbstractConsumer | 15 | abstract class AbstractConsumer |
14 | { | 16 | { |
@@ -17,11 +19,12 @@ abstract class AbstractConsumer | |||
17 | protected $import; | 19 | protected $import; |
18 | protected $logger; | 20 | protected $logger; |
19 | 21 | ||
20 | public function __construct(EntityManager $em, UserRepository $userRepository, AbstractImport $import, LoggerInterface $logger = null) | 22 | public function __construct(EntityManager $em, UserRepository $userRepository, AbstractImport $import, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger = null) |
21 | { | 23 | { |
22 | $this->em = $em; | 24 | $this->em = $em; |
23 | $this->userRepository = $userRepository; | 25 | $this->userRepository = $userRepository; |
24 | $this->import = $import; | 26 | $this->import = $import; |
27 | $this->eventDispatcher = $eventDispatcher; | ||
25 | $this->logger = $logger ?: new NullLogger(); | 28 | $this->logger = $logger ?: new NullLogger(); |
26 | } | 29 | } |
27 | 30 | ||
@@ -59,6 +62,9 @@ abstract class AbstractConsumer | |||
59 | try { | 62 | try { |
60 | $this->em->flush(); | 63 | $this->em->flush(); |
61 | 64 | ||
65 | // entry saved, dispatch event about it! | ||
66 | $this->eventDispatcher->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); | ||
67 | |||
62 | // clear only affected entities | 68 | // clear only affected entities |
63 | $this->em->clear(Entry::class); | 69 | $this->em->clear(Entry::class); |
64 | $this->em->clear(Tag::class); | 70 | $this->em->clear(Tag::class); |