X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FEvent%2FSubscriber%2FSQLiteCascadeDeleteSubscriber.php;h=dcadeedfc484a794b115fd652718dbb54a569b80;hb=48b0163d247554d7e2f1ec63b717c8216ea9ec59;hp=3b4c4cf9fedfdd8d8e5ff1ffd141336873a92a68;hpb=f17b89fadce0a8c2280fbe1518d66f20dddce59d;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php b/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php index 3b4c4cf9..dcadeedf 100644 --- a/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php +++ b/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php @@ -2,10 +2,10 @@ namespace Wallabag\CoreBundle\Event\Subscriber; +use Doctrine\Bundle\DoctrineBundle\Registry; use Doctrine\Common\EventSubscriber; use Doctrine\ORM\Event\LifecycleEventArgs; use Wallabag\CoreBundle\Entity\Entry; -use Doctrine\Bundle\DoctrineBundle\Registry; /** * SQLite doesn't care about cascading remove, so we need to manually remove associated stuf for an Entry. @@ -18,9 +18,6 @@ class SQLiteCascadeDeleteSubscriber implements EventSubscriber { private $doctrine; - /** - * @param \Doctrine\Bundle\DoctrineBundle\Registry $doctrine - */ public function __construct(Registry $doctrine) { $this->doctrine = $doctrine; @@ -39,15 +36,12 @@ class SQLiteCascadeDeleteSubscriber implements EventSubscriber /** * We removed everything related to the upcoming removed entry because SQLite can't handle it on it own. * We do it in the preRemove, because we can't retrieve tags in the postRemove (because the entry id is gone). - * - * @param LifecycleEventArgs $args */ public function preRemove(LifecycleEventArgs $args) { $entity = $args->getEntity(); - - if (!$this->doctrine->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver || - !$entity instanceof Entry) { + if (!$this->doctrine->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform + || !$entity instanceof Entry) { return; }