- return $person;
- }
-
- /**
- * @Rest\Get(
- * path = "/api/person/{id}/friends",
- * name = "show_person_friends",
- * requirements = {"id"="\d+"}
- * )
- * @Rest\View()
- */
- public function showPersonFriends(Request $request)
- {
+ return $person->getFriends();
+ }
+
+ /**
+ * @Rest\Get(
+ * path = "/api/persons",
+ * name = "show_persons"
+ * )
+ * @Rest\View()
+ */
+ public function showPersons(Request $request)
+ {
+ $em = $this->getDoctrine()->getManager();
+ $persons = $em->getRepository('App:Person')->findAll();
+
+ if (empty($persons)) {
+ return $this->PersonsNotFound();
+ }
+
+ return $persons;
+ }
+
+ /**
+ * @Rest\Put(
+ * path = "/api/person/{id}/online",
+ * name = "set_person_online"
+ * )
+ * @Rest\View(StatusCode = Response::HTTP_CREATED)
+ */
+ public function onlinePersonAction(Request $request)
+ {
+ //TODO: check that the authenticated user have the same id