aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeremy <j0k3r@users.noreply.github.com>2015-02-06 09:55:16 +0100
committerJeremy <j0k3r@users.noreply.github.com>2015-02-06 09:55:16 +0100
commit29c4517f7a8ed08239e5bee3d6c3fa823a83d102 (patch)
tree5d5bd15db7ae19994da55574ade821acdc115c36
parentc8dee953961964aa842e516995f0c6fafd007f9b (diff)
parentbe463487cc195026b11e92f1d6d6276f5851b97e (diff)
downloadwallabag-29c4517f7a8ed08239e5bee3d6c3fa823a83d102.tar.gz
wallabag-29c4517f7a8ed08239e5bee3d6c3fa823a83d102.tar.zst
wallabag-29c4517f7a8ed08239e5bee3d6c3fa823a83d102.zip
Merge pull request #1059 from wallabag/rename-entry
Rename entry
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php26
-rw-r--r--src/Wallabag/CoreBundle/Controller/WallabagRestController.php29
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php (renamed from src/Wallabag/CoreBundle/Entity/Entries.php)95
-rw-r--r--src/Wallabag/CoreBundle/Helper/Entry.php (renamed from src/Wallabag/CoreBundle/Helper/Entries.php)2
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php (renamed from src/Wallabag/CoreBundle/Repository/EntriesRepository.php)19
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig4
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/Entry/entry.html.twig4
7 files changed, 88 insertions, 91 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index eb5b43ad..6326d31f 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -5,8 +5,8 @@ namespace Wallabag\CoreBundle\Controller;
5use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; 5use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6use Symfony\Bundle\FrameworkBundle\Controller\Controller; 6use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7use Symfony\Component\HttpFoundation\Request; 7use Symfony\Component\HttpFoundation\Request;
8use Wallabag\CoreBundle\Entity\Entry;
8use Wallabag\CoreBundle\Repository; 9use Wallabag\CoreBundle\Repository;
9use Wallabag\CoreBundle\Entity\Entries;
10use Wallabag\CoreBundle\Service\Extractor; 10use Wallabag\CoreBundle\Service\Extractor;
11use Wallabag\CoreBundle\Helper\Url; 11use Wallabag\CoreBundle\Helper\Url;
12 12
@@ -19,7 +19,7 @@ class EntryController extends Controller
19 */ 19 */
20 public function addEntryAction(Request $request) 20 public function addEntryAction(Request $request)
21 { 21 {
22 $entry = new Entries(); 22 $entry = new Entry();
23 $entry->setUserId(1); 23 $entry->setUserId(1);
24 24
25 $form = $this->createFormBuilder($entry) 25 $form = $this->createFormBuilder($entry)
@@ -60,7 +60,7 @@ class EntryController extends Controller
60 */ 60 */
61 public function showUnreadAction() 61 public function showUnreadAction()
62 { 62 {
63 $repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entries'); 63 $repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry');
64 // TODO don't give the user ID like this 64 // TODO don't give the user ID like this
65 // TODO change pagination 65 // TODO change pagination
66 $entries = $repository->findUnreadByUser(1, 0); 66 $entries = $repository->findUnreadByUser(1, 0);
@@ -79,7 +79,7 @@ class EntryController extends Controller
79 */ 79 */
80 public function showArchiveAction() 80 public function showArchiveAction()
81 { 81 {
82 $repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entries'); 82 $repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry');
83 // TODO don't give the user ID like this 83 // TODO don't give the user ID like this
84 // TODO change pagination 84 // TODO change pagination
85 $entries = $repository->findArchiveByUser(1, 0); 85 $entries = $repository->findArchiveByUser(1, 0);
@@ -98,7 +98,7 @@ class EntryController extends Controller
98 */ 98 */
99 public function showStarredAction() 99 public function showStarredAction()
100 { 100 {
101 $repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entries'); 101 $repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry');
102 // TODO don't give the user ID like this 102 // TODO don't give the user ID like this
103 // TODO change pagination 103 // TODO change pagination
104 $entries = $repository->findStarredByUser(1, 0); 104 $entries = $repository->findStarredByUser(1, 0);
@@ -112,11 +112,11 @@ class EntryController extends Controller
112 /** 112 /**
113 * Shows entry content 113 * Shows entry content
114 * 114 *
115 * @param Entries $entry 115 * @param Entry $entry
116 * @Route("/view/{id}", requirements={"id" = "\d+"}, name="view") 116 * @Route("/view/{id}", requirements={"id" = "\d+"}, name="view")
117 * @return \Symfony\Component\HttpFoundation\Response 117 * @return \Symfony\Component\HttpFoundation\Response
118 */ 118 */
119 public function viewAction(Entries $entry) 119 public function viewAction(Entry $entry)
120 { 120 {
121 return $this->render( 121 return $this->render(
122 'WallabagCoreBundle:Entry:entry.html.twig', 122 'WallabagCoreBundle:Entry:entry.html.twig',
@@ -128,11 +128,11 @@ class EntryController extends Controller
128 * Changes read status for an entry 128 * Changes read status for an entry
129 * 129 *
130 * @param Request $request 130 * @param Request $request
131 * @param Entries $entry 131 * @param Entry $entry
132 * @Route("/archive/{id}", requirements={"id" = "\d+"}, name="archive_entry") 132 * @Route("/archive/{id}", requirements={"id" = "\d+"}, name="archive_entry")
133 * @return \Symfony\Component\HttpFoundation\RedirectResponse 133 * @return \Symfony\Component\HttpFoundation\RedirectResponse
134 */ 134 */
135 public function toggleArchiveAction(Request $request, Entries $entry) 135 public function toggleArchiveAction(Request $request, Entry $entry)
136 { 136 {
137 $entry->toggleArchive(); 137 $entry->toggleArchive();
138 $this->getDoctrine()->getManager()->flush(); 138 $this->getDoctrine()->getManager()->flush();
@@ -149,11 +149,11 @@ class EntryController extends Controller
149 * Changes favorite status for an entry 149 * Changes favorite status for an entry
150 * 150 *
151 * @param Request $request 151 * @param Request $request
152 * @param Entries $entry 152 * @param Entry $entry
153 * @Route("/star/{id}", requirements={"id" = "\d+"}, name="star_entry") 153 * @Route("/star/{id}", requirements={"id" = "\d+"}, name="star_entry")
154 * @return \Symfony\Component\HttpFoundation\RedirectResponse 154 * @return \Symfony\Component\HttpFoundation\RedirectResponse
155 */ 155 */
156 public function toggleStarAction(Request $request, Entries $entry) 156 public function toggleStarAction(Request $request, Entry $entry)
157 { 157 {
158 $entry->toggleStar(); 158 $entry->toggleStar();
159 $this->getDoctrine()->getManager()->flush(); 159 $this->getDoctrine()->getManager()->flush();
@@ -170,11 +170,11 @@ class EntryController extends Controller
170 * Deletes entry 170 * Deletes entry
171 * 171 *
172 * @param Request $request 172 * @param Request $request
173 * @param Entries $entry 173 * @param Entry $entry
174 * @Route("/delete/{id}", requirements={"id" = "\d+"}, name="delete_entry") 174 * @Route("/delete/{id}", requirements={"id" = "\d+"}, name="delete_entry")
175 * @return \Symfony\Component\HttpFoundation\RedirectResponse 175 * @return \Symfony\Component\HttpFoundation\RedirectResponse
176 */ 176 */
177 public function deleteEntryAction(Request $request, Entries $entry) 177 public function deleteEntryAction(Request $request, Entry $entry)
178 { 178 {
179 $em = $this->getDoctrine()->getManager(); 179 $em = $this->getDoctrine()->getManager();
180 $entry->setDeleted(1); 180 $entry->setDeleted(1);
diff --git a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
index f14f821b..1df18247 100644
--- a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
+++ b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
@@ -6,7 +6,7 @@ use Nelmio\ApiDocBundle\Annotation\ApiDoc;
6use Symfony\Bundle\FrameworkBundle\Controller\Controller; 6use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7use Symfony\Component\HttpFoundation\Request; 7use Symfony\Component\HttpFoundation\Request;
8use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; 8use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
9use Wallabag\CoreBundle\Entity\Entries; 9use Wallabag\CoreBundle\Entity\Entry;
10use Wallabag\CoreBundle\Entity\Tags; 10use Wallabag\CoreBundle\Entity\Tags;
11use Wallabag\CoreBundle\Service\Extractor; 11use Wallabag\CoreBundle\Service\Extractor;
12 12
@@ -27,7 +27,7 @@ class WallabagRestController extends Controller
27 * {"name"="tags", "dataType"="string", "required"=false, "format"="api%2Crest", "description"="a list of tags url encoded. Will returns entries that matches ALL tags."}, 27 * {"name"="tags", "dataType"="string", "required"=false, "format"="api%2Crest", "description"="a list of tags url encoded. Will returns entries that matches ALL tags."},
28 * } 28 * }
29 * ) 29 * )
30 * @return Entries 30 * @return Entry
31 */ 31 */
32 public function getEntriesAction(Request $request) 32 public function getEntriesAction(Request $request)
33 { 33 {
@@ -42,7 +42,7 @@ class WallabagRestController extends Controller
42 42
43 $entries = $this 43 $entries = $this
44 ->getDoctrine() 44 ->getDoctrine()
45 ->getRepository('WallabagCoreBundle:Entries') 45 ->getRepository('WallabagCoreBundle:Entry')
46 ->findEntries(1, $isArchived, $isStarred, $isDeleted, $sort, $order); 46 ->findEntries(1, $isArchived, $isStarred, $isDeleted, $sort, $order);
47 47
48 if (!is_array($entries)) { 48 if (!is_array($entries)) {
@@ -60,9 +60,9 @@ class WallabagRestController extends Controller
60 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} 60 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
61 * } 61 * }
62 * ) 62 * )
63 * @return Entries 63 * @return Entry
64 */ 64 */
65 public function getEntryAction(Entries $entry) 65 public function getEntryAction(Entry $entry)
66 { 66 {
67 return $entry; 67 return $entry;
68 } 68 }
@@ -77,6 +77,7 @@ class WallabagRestController extends Controller
77 * {"name"="tags", "dataType"="string", "required"=false, "format"="tag1,tag2,tag3", "description"="a comma-separated list of tags."}, 77 * {"name"="tags", "dataType"="string", "required"=false, "format"="tag1,tag2,tag3", "description"="a comma-separated list of tags."},
78 * } 78 * }
79 * ) 79 * )
80 * @return Entry
80 */ 81 */
81 public function postEntriesAction(Request $request) 82 public function postEntriesAction(Request $request)
82 { 83 {
@@ -84,7 +85,7 @@ class WallabagRestController extends Controller
84 $url = $request->request->get('url'); 85 $url = $request->request->get('url');
85 86
86 $content = Extractor::extract($url); 87 $content = Extractor::extract($url);
87 $entry = new Entries(); 88 $entry = new Entry();
88 $entry->setUserId(1); 89 $entry->setUserId(1);
89 $entry->setUrl($url); 90 $entry->setUrl($url);
90 $entry->setTitle($request->request->get('title') ?: $content->getTitle()); 91 $entry->setTitle($request->request->get('title') ?: $content->getTitle());
@@ -111,8 +112,9 @@ class WallabagRestController extends Controller
111 * {"name"="delete", "dataType"="boolean", "required"=false, "format"="true or false", "description"="flag as deleted. Default false. In case that you don't want to *really* remove it.."}, 112 * {"name"="delete", "dataType"="boolean", "required"=false, "format"="true or false", "description"="flag as deleted. Default false. In case that you don't want to *really* remove it.."},
112 * } 113 * }
113 * ) 114 * )
115 * @return Entry
114 */ 116 */
115 public function patchEntriesAction(Entries $entry, Request $request) 117 public function patchEntriesAction(Entry $entry, Request $request)
116 { 118 {
117 $title = $request->request->get("title"); 119 $title = $request->request->get("title");
118 $tags = $request->request->get("tags", array()); 120 $tags = $request->request->get("tags", array());
@@ -125,7 +127,7 @@ class WallabagRestController extends Controller
125 } 127 }
126 128
127 if (!is_null($isArchived)) { 129 if (!is_null($isArchived)) {
128 $entry->setRead($isArchived); 130 $entry->setArchived($isArchived);
129 } 131 }
130 132
131 if (!is_null($isDeleted)) { 133 if (!is_null($isDeleted)) {
@@ -133,7 +135,7 @@ class WallabagRestController extends Controller
133 } 135 }
134 136
135 if (!is_null($isStarred)) { 137 if (!is_null($isStarred)) {
136 $entry->setFav($isStarred); 138 $entry->setStarred($isStarred);
137 } 139 }
138 140
139 $em = $this->getDoctrine()->getManager(); 141 $em = $this->getDoctrine()->getManager();
@@ -150,8 +152,9 @@ class WallabagRestController extends Controller
150 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"} 152 * {"name"="entry", "dataType"="integer", "requirement"="\w+", "description"="The entry ID"}
151 * } 153 * }
152 * ) 154 * )
155 * @return Entry
153 */ 156 */
154 public function deleteEntriesAction(Entries $entry) 157 public function deleteEntriesAction(Entry $entry)
155 { 158 {
156 if ($entry->isDeleted()) { 159 if ($entry->isDeleted()) {
157 throw new NotFoundHttpException('This entry is already deleted'); 160 throw new NotFoundHttpException('This entry is already deleted');
@@ -173,7 +176,7 @@ class WallabagRestController extends Controller
173 * } 176 * }
174 * ) 177 * )
175 */ 178 */
176 public function getEntriesTagsAction(Entries $entry) 179 public function getEntriesTagsAction(Entry $entry)
177 { 180 {
178 } 181 }
179 182
@@ -189,7 +192,7 @@ class WallabagRestController extends Controller
189 * } 192 * }
190 * ) 193 * )
191 */ 194 */
192 public function postEntriesTagsAction(Entries $entry) 195 public function postEntriesTagsAction(Entry $entry)
193 { 196 {
194 } 197 }
195 198
@@ -203,7 +206,7 @@ class WallabagRestController extends Controller
203 * } 206 * }
204 * ) 207 * )
205 */ 208 */
206 public function deleteEntriesTagsAction(Entries $entry, Tags $tag) 209 public function deleteEntriesTagsAction(Entry $entry, Tags $tag)
207 { 210 {
208 } 211 }
209 212
diff --git a/src/Wallabag/CoreBundle/Entity/Entries.php b/src/Wallabag/CoreBundle/Entity/Entry.php
index ab5b859b..70c1dc08 100644
--- a/src/Wallabag/CoreBundle/Entity/Entries.php
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php
@@ -6,23 +6,23 @@ use Doctrine\ORM\Mapping as ORM;
6use Symfony\Component\Validator\Constraints as Assert; 6use Symfony\Component\Validator\Constraints as Assert;
7 7
8/** 8/**
9 * Entries 9 * Entry
10 * 10 *
11 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\EntriesRepository") 11 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\EntryRepository")
12 * @ORM\Table(name="entries") 12 * @ORM\Table(name="entry")
13 * @ORM\HasLifecycleCallbacks() 13 * @ORM\HasLifecycleCallbacks()
14 * 14 *
15 */ 15 */
16class Entries 16class Entry
17{ 17{
18 /** 18 /**
19 * @var integer 19 * @var integer
20 * 20 *
21 * @ORM\Column(name="id", type="integer", nullable=true) 21 * @ORM\Column(name="id", type="integer")
22 * @ORM\Id 22 * @ORM\Id
23 * @ORM\GeneratedValue(strategy="AUTO") 23 * @ORM\GeneratedValue(strategy="AUTO")
24 */ 24 */
25 private $id = null; 25 private $id;
26 26
27 /** 27 /**
28 * @var string 28 * @var string
@@ -42,21 +42,21 @@ class Entries
42 /** 42 /**
43 * @var boolean 43 * @var boolean
44 * 44 *
45 * @ORM\Column(name="is_read", type="boolean", nullable=true, options={"default" = false}) 45 * @ORM\Column(name="is_archived", type="boolean")
46 */ 46 */
47 private $isRead = false; 47 private $isArchived = false;
48 48
49 /** 49 /**
50 * @var boolean 50 * @var boolean
51 * 51 *
52 * @ORM\Column(name="is_fav", type="boolean", nullable=true, options={"default" = false}) 52 * @ORM\Column(name="is_starred", type="boolean")
53 */ 53 */
54 private $isFav = false; 54 private $isStarred = false;
55 55
56 /** 56 /**
57 * @var boolean 57 * @var boolean
58 * 58 *
59 * @ORM\Column(name="is_deleted", type="boolean", nullable=true, options={"default" = false}) 59 * @ORM\Column(name="is_deleted", type="boolean")
60 */ 60 */
61 private $isDeleted = false; 61 private $isDeleted = false;
62 62
@@ -70,14 +70,14 @@ class Entries
70 /** 70 /**
71 * @var date 71 * @var date
72 * 72 *
73 * @ORM\Column(name="created_at", type="datetime", nullable=true) 73 * @ORM\Column(name="created_at", type="datetime")
74 */ 74 */
75 private $createdAt; 75 private $createdAt;
76 76
77 /** 77 /**
78 * @var date 78 * @var date
79 * 79 *
80 * @ORM\Column(name="updated_at", type="datetime", nullable=true) 80 * @ORM\Column(name="updated_at", type="datetime")
81 */ 81 */
82 private $updatedAt; 82 private $updatedAt;
83 83
@@ -136,8 +136,8 @@ class Entries
136 /** 136 /**
137 * Set title 137 * Set title
138 * 138 *
139 * @param string $title 139 * @param string $title
140 * @return Entries 140 * @return Entry
141 */ 141 */
142 public function setTitle($title) 142 public function setTitle($title)
143 { 143 {
@@ -159,8 +159,8 @@ class Entries
159 /** 159 /**
160 * Set url 160 * Set url
161 * 161 *
162 * @param string $url 162 * @param string $url
163 * @return Entries 163 * @return Entry
164 */ 164 */
165 public function setUrl($url) 165 public function setUrl($url)
166 { 166 {
@@ -180,61 +180,61 @@ class Entries
180 } 180 }
181 181
182 /** 182 /**
183 * Set isRead 183 * Set isArchived
184 * 184 *
185 * @param string $isRead 185 * @param string $isArchived
186 * @return Entries 186 * @return Entry
187 */ 187 */
188 public function setRead($isRead) 188 public function setArchived($isArchived)
189 { 189 {
190 $this->isRead = $isRead; 190 $this->isArchived = $isArchived;
191 191
192 return $this; 192 return $this;
193 } 193 }
194 194
195 /** 195 /**
196 * Get isRead 196 * Get isArchived
197 * 197 *
198 * @return string 198 * @return string
199 */ 199 */
200 public function isRead() 200 public function isArchived()
201 { 201 {
202 return $this->isRead; 202 return $this->isArchived;
203 } 203 }
204 204
205 public function toggleArchive() 205 public function toggleArchive()
206 { 206 {
207 $this->isRead = $this->getIsRead() ^ 1; 207 $this->isArchived = $this->isArchived() ^ 1;
208 208
209 return $this; 209 return $this;
210 } 210 }
211 211
212 /** 212 /**
213 * Set isFav 213 * Set isStarred
214 * 214 *
215 * @param string $isFav 215 * @param string $isStarred
216 * @return Entries 216 * @return Entry
217 */ 217 */
218 public function setFav($isFav) 218 public function setStarred($isStarred)
219 { 219 {
220 $this->isFav = $isFav; 220 $this->isStarred = $isStarred;
221 221
222 return $this; 222 return $this;
223 } 223 }
224 224
225 /** 225 /**
226 * Get isFav 226 * Get isStarred
227 * 227 *
228 * @return string 228 * @return string
229 */ 229 */
230 public function isFav() 230 public function isStarred()
231 { 231 {
232 return $this->isFav; 232 return $this->isStarred;
233 } 233 }
234 234
235 public function toggleStar() 235 public function toggleStar()
236 { 236 {
237 $this->isFav = $this->getIsFav() ^ 1; 237 $this->isStarred = $this->isStarred() ^ 1;
238 238
239 return $this; 239 return $this;
240 } 240 }
@@ -242,8 +242,8 @@ class Entries
242 /** 242 /**
243 * Set content 243 * Set content
244 * 244 *
245 * @param string $content 245 * @param string $content
246 * @return Entries 246 * @return Entry
247 */ 247 */
248 public function setContent($content) 248 public function setContent($content)
249 { 249 {
@@ -265,8 +265,8 @@ class Entries
265 /** 265 /**
266 * Set userId 266 * Set userId
267 * 267 *
268 * @param string $userId 268 * @param string $userId
269 * @return Entries 269 * @return Entry
270 */ 270 */
271 public function setUserId($userId) 271 public function setUserId($userId)
272 { 272 {
@@ -310,15 +310,6 @@ class Entries
310 } 310 }
311 311
312 /** 312 /**
313 * @param mixed $createdAt
314 * @ORM\PrePersist
315 */
316 public function setCreatedAt()
317 {
318 $this->createdAt = new \DateTime();
319 }
320
321 /**
322 * @return string 313 * @return string
323 */ 314 */
324 public function getUpdatedAt() 315 public function getUpdatedAt()
@@ -327,11 +318,15 @@ class Entries
327 } 318 }
328 319
329 /** 320 /**
330 * @param string $updatedAt 321 * @ORM\PrePersist
331 * @ORM\PreUpdate 322 * @ORM\PreUpdate
332 */ 323 */
333 public function setUpdatedAt() 324 public function timestamps()
334 { 325 {
326 if (is_null($this->createdAt)) {
327 $this->createdAt = new \DateTime();
328 }
329
335 $this->updatedAt = new \DateTime(); 330 $this->updatedAt = new \DateTime();
336 } 331 }
337 332
diff --git a/src/Wallabag/CoreBundle/Helper/Entries.php b/src/Wallabag/CoreBundle/Helper/Entry.php
index 6eeca4ff..219711b3 100644
--- a/src/Wallabag/CoreBundle/Helper/Entries.php
+++ b/src/Wallabag/CoreBundle/Helper/Entry.php
@@ -2,6 +2,6 @@
2 2
3namespace Wallabag\CoreBundle\Helper; 3namespace Wallabag\CoreBundle\Helper;
4 4
5class Entries 5class Entry
6{ 6{
7} 7}
diff --git a/src/Wallabag/CoreBundle/Repository/EntriesRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index ae854e5a..f4c803f9 100644
--- a/src/Wallabag/CoreBundle/Repository/EntriesRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -5,9 +5,8 @@ namespace Wallabag\CoreBundle\Repository;
5use Doctrine\ORM\Query; 5use Doctrine\ORM\Query;
6use Doctrine\ORM\EntityRepository; 6use Doctrine\ORM\EntityRepository;
7use Doctrine\ORM\Tools\Pagination\Paginator; 7use Doctrine\ORM\Tools\Pagination\Paginator;
8use Wallabag\CoreBundle\Entity\Entries;
9 8
10class EntriesRepository extends EntityRepository 9class EntryRepository extends EntityRepository
11{ 10{
12 /** 11 /**
13 * Retrieves unread entries for a user 12 * Retrieves unread entries for a user
@@ -23,9 +22,9 @@ class EntriesRepository extends EntityRepository
23 ->select('e') 22 ->select('e')
24 ->setFirstResult($firstResult) 23 ->setFirstResult($firstResult)
25 ->setMaxResults($maxResults) 24 ->setMaxResults($maxResults)
26 ->where('e.isRead = 0') 25 ->where('e.isArchived = false')
27 ->andWhere('e.userId =:userId')->setParameter('userId', $userId) 26 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
28 ->andWhere('e.isDeleted=0') 27 ->andWhere('e.isDeleted=false')
29 ->orderBy('e.createdAt', 'desc') 28 ->orderBy('e.createdAt', 'desc')
30 ->getQuery(); 29 ->getQuery();
31 30
@@ -48,9 +47,9 @@ class EntriesRepository extends EntityRepository
48 ->select('e') 47 ->select('e')
49 ->setFirstResult($firstResult) 48 ->setFirstResult($firstResult)
50 ->setMaxResults($maxResults) 49 ->setMaxResults($maxResults)
51 ->where('e.isRead = 1') 50 ->where('e.isArchived = true')
52 ->andWhere('e.userId =:userId')->setParameter('userId', $userId) 51 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
53 ->andWhere('e.isDeleted=0') 52 ->andWhere('e.isDeleted=false')
54 ->orderBy('e.createdAt', 'desc') 53 ->orderBy('e.createdAt', 'desc')
55 ->getQuery(); 54 ->getQuery();
56 55
@@ -73,9 +72,9 @@ class EntriesRepository extends EntityRepository
73 ->select('e') 72 ->select('e')
74 ->setFirstResult($firstResult) 73 ->setFirstResult($firstResult)
75 ->setMaxResults($maxResults) 74 ->setMaxResults($maxResults)
76 ->where('e.isFav = 1') 75 ->where('e.isStarred = true')
77 ->andWhere('e.userId =:userId')->setParameter('userId', $userId) 76 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
78 ->andWhere('e.isDeleted=0') 77 ->andWhere('e.isDeleted=false')
79 ->orderBy('e.createdAt', 'desc') 78 ->orderBy('e.createdAt', 'desc')
80 ->getQuery(); 79 ->getQuery();
81 80
@@ -91,11 +90,11 @@ class EntriesRepository extends EntityRepository
91 ->where('e.userId =:userId')->setParameter('userId', $userId); 90 ->where('e.userId =:userId')->setParameter('userId', $userId);
92 91
93 if (!is_null($isArchived)) { 92 if (!is_null($isArchived)) {
94 $qb->andWhere('e.isRead =:isArchived')->setParameter('isArchived', $isArchived); 93 $qb->andWhere('e.isArchived =:isArchived')->setParameter('isArchived', $isArchived);
95 } 94 }
96 95
97 if (!is_null($isStarred)) { 96 if (!is_null($isStarred)) {
98 $qb->andWhere('e.isFav =:isStarred')->setParameter('isStarred', $isStarred); 97 $qb->andWhere('e.isStarred =:isStarred')->setParameter('isStarred', $isStarred);
99 } 98 }
100 99
101 if (!is_null($isDeleted)) { 100 if (!is_null($isDeleted)) {
diff --git a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig
index 2f8423d7..dfce4b3c 100644
--- a/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/Entry/entries.html.twig
@@ -35,8 +35,8 @@
35 {% endif %} 35 {% endif %}
36 36
37 <ul class="tools links"> 37 <ul class="tools links">
38 <li><a title="{% trans %}Toggle mark as read{% endtrans %}" class="tool icon-check icon {% if entry.isRead == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li> 38 <li><a title="{% trans %}Toggle mark as read{% endtrans %}" class="tool icon-check icon {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li>
39 <li><a title="{% trans %}toggle favorite{% endtrans %}" class="tool icon-star icon {% if entry.isFav == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{% trans %}toggle favorite{% endtrans %}</span></a></li> 39 <li><a title="{% trans %}toggle favorite{% endtrans %}" class="tool icon-star icon {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{% trans %}toggle favorite{% endtrans %}</span></a></li>
40 <li><a title="{% trans %}delete{% endtrans %}" class="tool delete icon-trash icon" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{% trans %}delete{% endtrans %}</span></a></li> 40 <li><a title="{% trans %}delete{% endtrans %}" class="tool delete icon-trash icon" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{% trans %}delete{% endtrans %}</span></a></li>
41 <li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon-link icon"><span>{{ entry.url | e | domainName }}</span></a></li> 41 <li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon-link icon"><span>{{ entry.url | e | domainName }}</span></a></li>
42 </ul> 42 </ul>
diff --git a/src/Wallabag/CoreBundle/Resources/views/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/Entry/entry.html.twig
index edb15d55..f0c00509 100644
--- a/src/Wallabag/CoreBundle/Resources/views/Entry/entry.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/Entry/entry.html.twig
@@ -11,8 +11,8 @@
11 <ul class="links"> 11 <ul class="links">
12 <li class="topPosF"><a href="#top" title="{% trans %}Back to top{% endtrans %}" class="tool top icon icon-arrow-up-thick"><span>{% trans %}Back to top{% endtrans %}</span></a></li> 12 <li class="topPosF"><a href="#top" title="{% trans %}Back to top{% endtrans %}" class="tool top icon icon-arrow-up-thick"><span>{% trans %}Back to top{% endtrans %}</span></a></li>
13 <li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon icon-link"><span>{{ entry.url | e | domainName }}</span></a></li> 13 <li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon icon-link"><span>{{ entry.url | e | domainName }}</span></a></li>
14 <li><a title="{% trans %}Mark as read{% endtrans %}" class="tool icon icon-check {% if entry.isRead == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li> 14 <li><a title="{% trans %}Mark as read{% endtrans %}" class="tool icon icon-check {% if entry.isArchived == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li>
15 <li><a title="{% trans %}Favorite{% endtrans %}" class="tool icon icon-star {% if entry.isFav == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle favorite{% endtrans %}</span></a></li> 15 <li><a title="{% trans %}Favorite{% endtrans %}" class="tool icon icon-star {% if entry.isStarred == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle favorite{% endtrans %}</span></a></li>
16 <li><a title="{% trans %}Delete{% endtrans %}" class="tool delete icon icon-trash" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{% trans %}Delete{% endtrans %}</span></a></li> 16 <li><a title="{% trans %}Delete{% endtrans %}" class="tool delete icon icon-trash" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{% trans %}Delete{% endtrans %}</span></a></li>
17 {% if share_twitter %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter icon icon-twitter" title="{% trans %}Tweet{% endtrans %}"><span>{% trans %}Tweet{% endtrans %}</span></a></li>{% endif %} 17 {% if share_twitter %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter icon icon-twitter" title="{% trans %}Tweet{% endtrans %}"><span>{% trans %}Tweet{% endtrans %}</span></a></li>{% endif %}
18 {% if share_mail %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" class="tool email icon icon-mail" title="{% trans %}Email{% endtrans %}"><span>{% trans %}Email{% endtrans %}</span></a></li>{% endif %} 18 {% if share_mail %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&amp;body={{ entry.url|url_encode }}%20via%20@wallabagapp" class="tool email icon icon-mail" title="{% trans %}Email{% endtrans %}"><span>{% trans %}Email{% endtrans %}</span></a></li>{% endif %}