aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2015-12-29 21:59:34 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2015-12-29 21:59:34 +0100
commit6be9750155fa731d75898b4973a126a090345c2d (patch)
treec11052ebb1dfb2c3eb890dfa6d83a852ad9e4b0c
parent4059a061c0c8cc787f71e96aef2ab01599d3241d (diff)
downloadwallabag-6be9750155fa731d75898b4973a126a090345c2d.tar.gz
wallabag-6be9750155fa731d75898b4973a126a090345c2d.tar.zst
wallabag-6be9750155fa731d75898b4973a126a090345c2d.zip
Removed comment
And move the SQL query inside the php doc
-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 /**