use Hateoas\Configuration\Route;
use Hateoas\Representation\Factory\PagerfantaFactory;
-use JMS\Serializer\SerializationContext;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Pagerfanta\Adapter\DoctrineORMAdapter;
use Pagerfanta\Pagerfanta;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpFoundation\Response;
-use Symfony\Component\HttpKernel\Exception\HttpException;
-use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
-use Wallabag\CoreBundle\Entity\Entry;
-use Wallabag\CoreBundle\Entity\Tag;
-use Wallabag\CoreBundle\Event\EntryDeletedEvent;
-use Wallabag\CoreBundle\Event\EntrySavedEvent;
class SearchRestController extends WallabagRestController
{
'page' => $page,
'perPage' => $perPage,
],
- UrlGeneratorInterface::ABSOLUTE_URL
+ true
)
);
return $this->sendResponse($paginatedCollection);
}
-
- /**
- * Shortcut to send data serialized in json.
- *
- * @param mixed $data
- *
- * @return JsonResponse
- */
- private function sendResponse($data)
- {
- // https://github.com/schmittjoh/JMSSerializerBundle/issues/293
- $context = new SerializationContext();
- $context->setSerializeNull(true);
-
- $json = $this->get('jms_serializer')->serialize($data, 'json', $context);
-
- return (new JsonResponse())->setJson($json);
- }
}