mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-16 10:22:14 +01:00
Fix DateTime & clear()
This commit is contained in:
parent
6d65c0a8b0
commit
8664069e1a
@ -97,7 +97,7 @@ class Entry
|
|||||||
private $content;
|
private $content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var date
|
* @var \DateTime
|
||||||
*
|
*
|
||||||
* @ORM\Column(name="created_at", type="datetime")
|
* @ORM\Column(name="created_at", type="datetime")
|
||||||
*
|
*
|
||||||
@ -106,7 +106,7 @@ class Entry
|
|||||||
private $createdAt;
|
private $createdAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var date
|
* @var \DateTime
|
||||||
*
|
*
|
||||||
* @ORM\Column(name="updated_at", type="datetime")
|
* @ORM\Column(name="updated_at", type="datetime")
|
||||||
*
|
*
|
||||||
@ -413,7 +413,7 @@ class Entry
|
|||||||
* Set created_at.
|
* Set created_at.
|
||||||
* Only used when importing data from an other service.
|
* Only used when importing data from an other service.
|
||||||
*
|
*
|
||||||
* @param DateTime $createdAt
|
* @param \DateTime $createdAt
|
||||||
*
|
*
|
||||||
* @return Entry
|
* @return Entry
|
||||||
*/
|
*/
|
||||||
@ -425,7 +425,7 @@ class Entry
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return DateTime
|
* @return \DateTime
|
||||||
*/
|
*/
|
||||||
public function getCreatedAt()
|
public function getCreatedAt()
|
||||||
{
|
{
|
||||||
@ -433,7 +433,7 @@ class Entry
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return DateTime
|
* @return \DateTime
|
||||||
*/
|
*/
|
||||||
public function getUpdatedAt()
|
public function getUpdatedAt()
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,8 @@ use OldSound\RabbitMqBundle\RabbitMq\ConsumerInterface;
|
|||||||
use PhpAmqpLib\Message\AMQPMessage;
|
use PhpAmqpLib\Message\AMQPMessage;
|
||||||
use Wallabag\ImportBundle\Import\AbstractImport;
|
use Wallabag\ImportBundle\Import\AbstractImport;
|
||||||
use Wallabag\UserBundle\Repository\UserRepository;
|
use Wallabag\UserBundle\Repository\UserRepository;
|
||||||
|
use Wallabag\CoreBundle\Entity\Entry;
|
||||||
|
use Wallabag\CoreBundle\Entity\Tag;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Psr\Log\NullLogger;
|
use Psr\Log\NullLogger;
|
||||||
|
|
||||||
@ -53,7 +55,10 @@ class EntryConsumer implements ConsumerInterface
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$this->em->flush();
|
$this->em->flush();
|
||||||
$this->em->clear($entry);
|
|
||||||
|
// clear only affected entities
|
||||||
|
$this->em->clear(Entry::class);
|
||||||
|
$this->em->clear(Tag::class);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->logger->warning('Unable to save entry', ['entry' => $storedEntry, 'exception' => $e]);
|
$this->logger->warning('Unable to save entry', ['entry' => $storedEntry, 'exception' => $e]);
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ use Psr\Log\NullLogger;
|
|||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManager;
|
||||||
use Wallabag\CoreBundle\Helper\ContentProxy;
|
use Wallabag\CoreBundle\Helper\ContentProxy;
|
||||||
use Wallabag\CoreBundle\Entity\Entry;
|
use Wallabag\CoreBundle\Entity\Entry;
|
||||||
|
use Wallabag\CoreBundle\Entity\Tag;
|
||||||
use Wallabag\UserBundle\Entity\User;
|
use Wallabag\UserBundle\Entity\User;
|
||||||
use OldSound\RabbitMqBundle\RabbitMq\Producer;
|
use OldSound\RabbitMqBundle\RabbitMq\Producer;
|
||||||
|
|
||||||
@ -113,7 +114,10 @@ abstract class AbstractImport implements ImportInterface
|
|||||||
// flush every 20 entries
|
// flush every 20 entries
|
||||||
if (($i % 20) === 0) {
|
if (($i % 20) === 0) {
|
||||||
$this->em->flush();
|
$this->em->flush();
|
||||||
$this->em->clear($entry);
|
|
||||||
|
// clear only affected entities
|
||||||
|
$this->em->clear(Entry::class);
|
||||||
|
$this->em->clear(Tag::class);
|
||||||
}
|
}
|
||||||
++$i;
|
++$i;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user