use Nelmio\ApiDocBundle\Annotation\ApiDoc;
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;
$order = $request->query->get('order', 'desc');
$page = (int) $request->query->get('page', 1);
$perPage = (int) $request->query->get('perPage', 30);
- $tags = $request->query->get('tags', '');
+ $tags = is_array($request->query->get('tags')) ? '' : (string) $request->query->get('tags', '');
$since = $request->query->get('since', 0);
/** @var \Pagerfanta\Pagerfanta $pager */
return $this->get('wallabag_core.helper.entries_export')
->setEntries($entry)
->updateTitle('entry')
+ ->updateAuthor('entry')
->exportAs($request->attributes->get('_format'));
}
]);
}
- if (!is_null($data['isArchived'])) {
+ if (null !== $data['isArchived']) {
$entry->setArchived((bool) $data['isArchived']);
}
- if (!is_null($data['isStarred'])) {
- $entry->setStarred((bool) $data['isStarred']);
+ if (null !== $data['isStarred']) {
+ $entry->updateStar((bool) $data['isStarred']);
}
if (!empty($data['tags'])) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $data['tags']);
}
- if (!is_null($data['isPublic'])) {
+ if (null !== $data['isPublic']) {
if (true === (bool) $data['isPublic'] && null === $entry->getUid()) {
$entry->generateUid();
} elseif (false === (bool) $data['isPublic']) {
$contentProxy->updatePublishedAt($entry, $data['publishedAt']);
}
- if (!is_null($data['isArchived'])) {
+ if (null !== $data['isArchived']) {
$entry->setArchived((bool) $data['isArchived']);
}
- if (!is_null($data['isStarred'])) {
- $entry->setStarred((bool) $data['isStarred']);
+ if (null !== $data['isStarred']) {
+ $entry->updateStar((bool) $data['isStarred']);
}
if (!empty($data['tags'])) {
$this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $data['tags']);
}
- if (!is_null($data['isPublic'])) {
+ if (null !== $data['isPublic']) {
if (true === (bool) $data['isPublic'] && null === $entry->getUid()) {
$entry->generateUid();
} elseif (false === (bool) $data['isPublic']) {
$context = new SerializationContext();
$context->setSerializeNull(true);
- $json = $this->get('serializer')->serialize($data, 'json', $context);
+ $json = $this->get('jms_serializer')->serialize($data, 'json', $context);
return (new JsonResponse())->setJson($json);
}