aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/WallabagRestController.php')
-rw-r--r--src/Wallabag/CoreBundle/Controller/WallabagRestController.php25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/WallabagRestController.php b/src/Wallabag/CoreBundle/Controller/WallabagRestController.php
index 75de58f7..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());
@@ -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