diff options
Diffstat (limited to 'src/Wallabag')
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 10 | ||||
-rw-r--r-- | src/Wallabag/ImportBundle/Consumer/AMPQ/EntryConsumer.php | 7 | ||||
-rw-r--r-- | src/Wallabag/ImportBundle/Import/AbstractImport.php | 6 |
3 files changed, 16 insertions, 7 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 304258a9..a4b0d7a8 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php | |||
@@ -97,7 +97,7 @@ class Entry | |||
97 | private $content; | 97 | private $content; |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * @var date | 100 | * @var \DateTime |
101 | * | 101 | * |
102 | * @ORM\Column(name="created_at", type="datetime") | 102 | * @ORM\Column(name="created_at", type="datetime") |
103 | * | 103 | * |
@@ -106,7 +106,7 @@ class Entry | |||
106 | private $createdAt; | 106 | private $createdAt; |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * @var date | 109 | * @var \DateTime |
110 | * | 110 | * |
111 | * @ORM\Column(name="updated_at", type="datetime") | 111 | * @ORM\Column(name="updated_at", type="datetime") |
112 | * | 112 | * |
@@ -413,7 +413,7 @@ class Entry | |||
413 | * Set created_at. | 413 | * Set created_at. |
414 | * Only used when importing data from an other service. | 414 | * Only used when importing data from an other service. |
415 | * | 415 | * |
416 | * @param DateTime $createdAt | 416 | * @param \DateTime $createdAt |
417 | * | 417 | * |
418 | * @return Entry | 418 | * @return Entry |
419 | */ | 419 | */ |
@@ -425,7 +425,7 @@ class Entry | |||
425 | } | 425 | } |
426 | 426 | ||
427 | /** | 427 | /** |
428 | * @return DateTime | 428 | * @return \DateTime |
429 | */ | 429 | */ |
430 | public function getCreatedAt() | 430 | public function getCreatedAt() |
431 | { | 431 | { |
@@ -433,7 +433,7 @@ class Entry | |||
433 | } | 433 | } |
434 | 434 | ||
435 | /** | 435 | /** |
436 | * @return DateTime | 436 | * @return \DateTime |
437 | */ | 437 | */ |
438 | public function getUpdatedAt() | 438 | public function getUpdatedAt() |
439 | { | 439 | { |
diff --git a/src/Wallabag/ImportBundle/Consumer/AMPQ/EntryConsumer.php b/src/Wallabag/ImportBundle/Consumer/AMPQ/EntryConsumer.php index 8a8cf45d..72a3260a 100644 --- a/src/Wallabag/ImportBundle/Consumer/AMPQ/EntryConsumer.php +++ b/src/Wallabag/ImportBundle/Consumer/AMPQ/EntryConsumer.php | |||
@@ -7,6 +7,8 @@ use OldSound\RabbitMqBundle\RabbitMq\ConsumerInterface; | |||
7 | use PhpAmqpLib\Message\AMQPMessage; | 7 | use PhpAmqpLib\Message\AMQPMessage; |
8 | use Wallabag\ImportBundle\Import\AbstractImport; | 8 | use Wallabag\ImportBundle\Import\AbstractImport; |
9 | use Wallabag\UserBundle\Repository\UserRepository; | 9 | use Wallabag\UserBundle\Repository\UserRepository; |
10 | use Wallabag\CoreBundle\Entity\Entry; | ||
11 | use Wallabag\CoreBundle\Entity\Tag; | ||
10 | use Psr\Log\LoggerInterface; | 12 | use Psr\Log\LoggerInterface; |
11 | use Psr\Log\NullLogger; | 13 | use Psr\Log\NullLogger; |
12 | 14 | ||
@@ -53,7 +55,10 @@ class EntryConsumer implements ConsumerInterface | |||
53 | 55 | ||
54 | try { | 56 | try { |
55 | $this->em->flush(); | 57 | $this->em->flush(); |
56 | $this->em->clear($entry); | 58 | |
59 | // clear only affected entities | ||
60 | $this->em->clear(Entry::class); | ||
61 | $this->em->clear(Tag::class); | ||
57 | } catch (\Exception $e) { | 62 | } catch (\Exception $e) { |
58 | $this->logger->warning('Unable to save entry', ['entry' => $storedEntry, 'exception' => $e]); | 63 | $this->logger->warning('Unable to save entry', ['entry' => $storedEntry, 'exception' => $e]); |
59 | 64 | ||
diff --git a/src/Wallabag/ImportBundle/Import/AbstractImport.php b/src/Wallabag/ImportBundle/Import/AbstractImport.php index 8610062d..39befa7b 100644 --- a/src/Wallabag/ImportBundle/Import/AbstractImport.php +++ b/src/Wallabag/ImportBundle/Import/AbstractImport.php | |||
@@ -7,6 +7,7 @@ use Psr\Log\NullLogger; | |||
7 | use Doctrine\ORM\EntityManager; | 7 | use Doctrine\ORM\EntityManager; |
8 | use Wallabag\CoreBundle\Helper\ContentProxy; | 8 | use Wallabag\CoreBundle\Helper\ContentProxy; |
9 | use Wallabag\CoreBundle\Entity\Entry; | 9 | use Wallabag\CoreBundle\Entity\Entry; |
10 | use Wallabag\CoreBundle\Entity\Tag; | ||
10 | use Wallabag\UserBundle\Entity\User; | 11 | use Wallabag\UserBundle\Entity\User; |
11 | use OldSound\RabbitMqBundle\RabbitMq\Producer; | 12 | use OldSound\RabbitMqBundle\RabbitMq\Producer; |
12 | 13 | ||
@@ -113,7 +114,10 @@ abstract class AbstractImport implements ImportInterface | |||
113 | // flush every 20 entries | 114 | // flush every 20 entries |
114 | if (($i % 20) === 0) { | 115 | if (($i % 20) === 0) { |
115 | $this->em->flush(); | 116 | $this->em->flush(); |
116 | $this->em->clear($entry); | 117 | |
118 | // clear only affected entities | ||
119 | $this->em->clear(Entry::class); | ||
120 | $this->em->clear(Tag::class); | ||
117 | } | 121 | } |
118 | ++$i; | 122 | ++$i; |
119 | } | 123 | } |