aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/AnnotationBundle
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/AnnotationBundle')
-rw-r--r--src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php2
-rw-r--r--src/Wallabag/AnnotationBundle/Entity/Annotation.php10
-rw-r--r--src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php32
3 files changed, 22 insertions, 22 deletions
diff --git a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
index 2b4b0e8d..8d7b6ee9 100644
--- a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
+++ b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
@@ -3,9 +3,9 @@
3namespace Wallabag\AnnotationBundle\Controller; 3namespace Wallabag\AnnotationBundle\Controller;
4 4
5use FOS\RestBundle\Controller\FOSRestController; 5use FOS\RestBundle\Controller\FOSRestController;
6use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
6use Symfony\Component\HttpFoundation\JsonResponse; 7use Symfony\Component\HttpFoundation\JsonResponse;
7use Symfony\Component\HttpFoundation\Request; 8use Symfony\Component\HttpFoundation\Request;
8use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
9use Wallabag\AnnotationBundle\Entity\Annotation; 9use Wallabag\AnnotationBundle\Entity\Annotation;
10use Wallabag\AnnotationBundle\Form\EditAnnotationType; 10use Wallabag\AnnotationBundle\Form\EditAnnotationType;
11use Wallabag\AnnotationBundle\Form\NewAnnotationType; 11use Wallabag\AnnotationBundle\Form\NewAnnotationType;
diff --git a/src/Wallabag/AnnotationBundle/Entity/Annotation.php b/src/Wallabag/AnnotationBundle/Entity/Annotation.php
index c8e41649..04d83001 100644
--- a/src/Wallabag/AnnotationBundle/Entity/Annotation.php
+++ b/src/Wallabag/AnnotationBundle/Entity/Annotation.php
@@ -3,14 +3,14 @@
3namespace Wallabag\AnnotationBundle\Entity; 3namespace Wallabag\AnnotationBundle\Entity;
4 4
5use Doctrine\ORM\Mapping as ORM; 5use Doctrine\ORM\Mapping as ORM;
6use JMS\Serializer\Annotation\ExclusionPolicy;
7use JMS\Serializer\Annotation\Exclude; 6use JMS\Serializer\Annotation\Exclude;
8use JMS\Serializer\Annotation\VirtualProperty; 7use JMS\Serializer\Annotation\ExclusionPolicy;
9use JMS\Serializer\Annotation\SerializedName;
10use JMS\Serializer\Annotation\Groups; 8use JMS\Serializer\Annotation\Groups;
9use JMS\Serializer\Annotation\SerializedName;
10use JMS\Serializer\Annotation\VirtualProperty;
11use Symfony\Component\Validator\Constraints as Assert; 11use Symfony\Component\Validator\Constraints as Assert;
12use Wallabag\UserBundle\Entity\User;
13use Wallabag\CoreBundle\Entity\Entry; 12use Wallabag\CoreBundle\Entity\Entry;
13use Wallabag\UserBundle\Entity\User;
14 14
15/** 15/**
16 * Annotation. 16 * Annotation.
@@ -139,7 +139,7 @@ class Annotation
139 */ 139 */
140 public function timestamps() 140 public function timestamps()
141 { 141 {
142 if (is_null($this->createdAt)) { 142 if (null === $this->createdAt) {
143 $this->createdAt = new \DateTime(); 143 $this->createdAt = new \DateTime();
144 } 144 }
145 $this->updatedAt = new \DateTime(); 145 $this->updatedAt = new \DateTime();
diff --git a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php
index da361308..014c29b6 100644
--- a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php
+++ b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php
@@ -10,22 +10,6 @@ use Doctrine\ORM\EntityRepository;
10class AnnotationRepository extends EntityRepository 10class AnnotationRepository extends EntityRepository
11{ 11{
12 /** 12 /**
13 * Return a query builder to used by other getBuilderFor* method.
14 *
15 * @param int $userId
16 *
17 * @return QueryBuilder
18 */
19 private function getBuilderByUser($userId)
20 {
21 return $this->createQueryBuilder('a')
22 ->leftJoin('a.user', 'u')
23 ->andWhere('u.id = :userId')->setParameter('userId', $userId)
24 ->orderBy('a.id', 'desc')
25 ;
26 }
27
28 /**
29 * Retrieves all annotations for a user. 13 * Retrieves all annotations for a user.
30 * 14 *
31 * @param int $userId 15 * @param int $userId
@@ -139,4 +123,20 @@ class AnnotationRepository extends EntityRepository
139 ->getQuery() 123 ->getQuery()
140 ->getResult(); 124 ->getResult();
141 } 125 }
126
127 /**
128 * Return a query builder to used by other getBuilderFor* method.
129 *
130 * @param int $userId
131 *
132 * @return QueryBuilder
133 */
134 private function getBuilderByUser($userId)
135 {
136 return $this->createQueryBuilder('a')
137 ->leftJoin('a.user', 'u')
138 ->andWhere('u.id = :userId')->setParameter('userId', $userId)
139 ->orderBy('a.id', 'desc')
140 ;
141 }
142} 142}