aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index e658a359..ca71970b 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -185,7 +185,9 @@ class EntryRepository extends EntityRepository
185 * Remove a tag from all user entries. 185 * Remove a tag from all user entries.
186 * 186 *
187 * We need to loop on each entry attached to the given tag to remove it, since Doctrine doesn't know EntryTag entity because it's a ManyToMany relation. 187 * We need to loop on each entry attached to the given tag to remove it, since Doctrine doesn't know EntryTag entity because it's a ManyToMany relation.
188 * It could be faster with one query but I don't know how to retrieve the table name `entry_tag` which can have a prefix. 188 * It could be faster with one query but I don't know how to retrieve the table name `entry_tag` which can have a prefix:
189 *
190 * DELETE et FROM entry_tag et WHERE et.entry_id IN ( SELECT e.id FROM entry e WHERE e.user_id = :userId ) AND et.tag_id = :tagId
189 * 191 *
190 * @param int $userId 192 * @param int $userId
191 * @param Tag $tag 193 * @param Tag $tag
@@ -203,14 +205,6 @@ class EntryRepository extends EntityRepository
203 } 205 }
204 206
205 $this->getEntityManager()->flush(); 207 $this->getEntityManager()->flush();
206
207 // An other solution can be to use raw query but I can't find a way to retrieve the `entry_tag` table name since it can be prefixed....
208 // $sql = 'DELETE et FROM entry_tag et WHERE et.entry_id IN ( SELECT e.id FROM entry e WHERE e.user_id = :userId ) AND et.tag_id = :tagId';
209 // $stmt = $this->getEntityManager()->getConnection()->prepare($sql);
210 // $stmt->execute([
211 // 'userId' => $userId,
212 // 'tagId' => $tag->getId(),
213 // ]);
214 } 208 }
215 209
216 /** 210 /**