+ /**
+ * @Rest\Get(
+ * path = "/api/person/search",
+ * name = "search_person"
+ * )
+ * @Rest\QueryParam(name="keyword")
+ * @Rest\View()
+ */
+ public function searchPerson(ParamFetcherInterface $paramFetcher)
+ {
+ $em = $this->getDoctrine()->getManager();
+ $query = $em->createQuery("SELECT DISTINCT p FROM App\Entity\Person p WHERE
+ p.firstname LIKE :keyword OR
+ p.lastname LIKE :keyword OR
+ p.email LIKE :keyword");
+ $query->setParameter('keyword', '%'.$paramFetcher->get('keyword').'%');
+ $persons = $query->getResult();
+
+ if (empty($persons)) {
+ return $this->PersonsNotFound();
+ }
+
+ return $persons;
+ }
+