]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge pull request #1054 from wallabag/v2-api-set-title-post
authorJeremy <j0k3r@users.noreply.github.com>
Thu, 5 Feb 2015 18:07:30 +0000 (19:07 +0100)
committerJeremy <j0k3r@users.noreply.github.com>
Thu, 5 Feb 2015 18:07:30 +0000 (19:07 +0100)
we can now set a title to the article when we use POST /api/entries

README.md
src/Wallabag/CoreBundle/Repository/EntriesRepository.php

index 13e730c9679aa2b3e07673fda9a758022527000c..1e33940a8de9fa70a9e4a31bfdfc8cbe90022951 100644 (file)
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ More informations on our website: [wallabag.org](http://wallabag.org)
 Keep in mind it's an **instable** branch, everything can be broken :)
 
 ```
-git clone https://github.com/wallabag/wallabag.git -b refactor
+git clone https://github.com/wallabag/wallabag.git -b v2
 cd wallabag
 composer install
 php app/console wallabag:install
index dd92d5200426ee4c004513eaf1c2a90099d090fa..ae854e5a91b8fbe1ed3da3f85c121c38c03a1d59 100644 (file)
@@ -26,6 +26,7 @@ class EntriesRepository extends EntityRepository
             ->where('e.isRead = 0')
             ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
             ->andWhere('e.isDeleted=0')
+            ->orderBy('e.createdAt', 'desc')
             ->getQuery();
 
         $paginator = new Paginator($qb);
@@ -50,6 +51,7 @@ class EntriesRepository extends EntityRepository
             ->where('e.isRead = 1')
             ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
             ->andWhere('e.isDeleted=0')
+            ->orderBy('e.createdAt', 'desc')
             ->getQuery();
 
         $paginator = new Paginator($qb);
@@ -74,6 +76,7 @@ class EntriesRepository extends EntityRepository
             ->where('e.isFav = 1')
             ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
             ->andWhere('e.isDeleted=0')
+            ->orderBy('e.createdAt', 'desc')
             ->getQuery();
 
         $paginator = new Paginator($qb);
@@ -83,7 +86,6 @@ class EntriesRepository extends EntityRepository
 
     public function findEntries($userId, $isArchived, $isStarred, $isDeleted, $sort, $order)
     {
-        //TODO tous les paramètres ne sont pas utilisés, à corriger
         $qb = $this->createQueryBuilder('e')
             ->select('e')
             ->where('e.userId =:userId')->setParameter('userId', $userId);
@@ -100,6 +102,12 @@ class EntriesRepository extends EntityRepository
             $qb->andWhere('e.isDeleted =:isDeleted')->setParameter('isDeleted', $isDeleted);
         }
 
+        if ('created' === $sort) {
+            $qb->orderBy('e.createdAt', $order);
+        } elseif ('updated' === $sort) {
+            $qb->orderBy('e.updatedAt', $order);
+        }
+
         return $qb
             ->getQuery()
             ->getResult(Query::HYDRATE_ARRAY);