diff options
Diffstat (limited to 'src/Wallabag/ImportBundle/Component')
-rw-r--r-- | src/Wallabag/ImportBundle/Component/AMPQ/EntryConsumer.php | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/Wallabag/ImportBundle/Component/AMPQ/EntryConsumer.php b/src/Wallabag/ImportBundle/Component/AMPQ/EntryConsumer.php deleted file mode 100644 index 7775f01c..00000000 --- a/src/Wallabag/ImportBundle/Component/AMPQ/EntryConsumer.php +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\ImportBundle\Component\AMPQ; | ||
4 | |||
5 | use Doctrine\ORM\EntityManager; | ||
6 | use OldSound\RabbitMqBundle\RabbitMq\ConsumerInterface; | ||
7 | use PhpAmqpLib\Message\AMQPMessage; | ||
8 | use Wallabag\CoreBundle\Helper\ContentProxy; | ||
9 | use Wallabag\CoreBundle\Repository\EntryRepository; | ||
10 | |||
11 | class EntryConsumer implements ConsumerInterface | ||
12 | { | ||
13 | private $em; | ||
14 | private $contentProxy; | ||
15 | private $entryRepository; | ||
16 | |||
17 | public function __construct(EntityManager $em, EntryRepository $entryRepository, ContentProxy $contentProxy) | ||
18 | { | ||
19 | $this->em = $em; | ||
20 | $this->entryRepository = $entryRepository; | ||
21 | $this->contentProxy = $contentProxy; | ||
22 | } | ||
23 | |||
24 | /** | ||
25 | * {@inheritdoc} | ||
26 | */ | ||
27 | public function execute(AMQPMessage $msg) | ||
28 | { | ||
29 | $storedEntry = unserialize($msg->body); | ||
30 | $entry = $this->entryRepository->findByUrlAndUserId($storedEntry['url'], $storedEntry['userId']); | ||
31 | if ($entry) { | ||
32 | $entry = $this->contentProxy->updateEntry($entry, $entry->getUrl()); | ||
33 | if ($entry) { | ||
34 | $this->em->persist($entry); | ||
35 | $this->em->flush(); | ||
36 | } | ||
37 | } | ||
38 | } | ||
39 | } | ||