diff options
Diffstat (limited to 'src/Wallabag/AnnotationBundle')
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 @@ | |||
3 | namespace Wallabag\AnnotationBundle\Controller; | 3 | namespace Wallabag\AnnotationBundle\Controller; |
4 | 4 | ||
5 | use FOS\RestBundle\Controller\FOSRestController; | 5 | use FOS\RestBundle\Controller\FOSRestController; |
6 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; | ||
6 | use Symfony\Component\HttpFoundation\JsonResponse; | 7 | use Symfony\Component\HttpFoundation\JsonResponse; |
7 | use Symfony\Component\HttpFoundation\Request; | 8 | use Symfony\Component\HttpFoundation\Request; |
8 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; | ||
9 | use Wallabag\AnnotationBundle\Entity\Annotation; | 9 | use Wallabag\AnnotationBundle\Entity\Annotation; |
10 | use Wallabag\AnnotationBundle\Form\EditAnnotationType; | 10 | use Wallabag\AnnotationBundle\Form\EditAnnotationType; |
11 | use Wallabag\AnnotationBundle\Form\NewAnnotationType; | 11 | use 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 @@ | |||
3 | namespace Wallabag\AnnotationBundle\Entity; | 3 | namespace Wallabag\AnnotationBundle\Entity; |
4 | 4 | ||
5 | use Doctrine\ORM\Mapping as ORM; | 5 | use Doctrine\ORM\Mapping as ORM; |
6 | use JMS\Serializer\Annotation\ExclusionPolicy; | ||
7 | use JMS\Serializer\Annotation\Exclude; | 6 | use JMS\Serializer\Annotation\Exclude; |
8 | use JMS\Serializer\Annotation\VirtualProperty; | 7 | use JMS\Serializer\Annotation\ExclusionPolicy; |
9 | use JMS\Serializer\Annotation\SerializedName; | ||
10 | use JMS\Serializer\Annotation\Groups; | 8 | use JMS\Serializer\Annotation\Groups; |
9 | use JMS\Serializer\Annotation\SerializedName; | ||
10 | use JMS\Serializer\Annotation\VirtualProperty; | ||
11 | use Symfony\Component\Validator\Constraints as Assert; | 11 | use Symfony\Component\Validator\Constraints as Assert; |
12 | use Wallabag\UserBundle\Entity\User; | ||
13 | use Wallabag\CoreBundle\Entity\Entry; | 12 | use Wallabag\CoreBundle\Entity\Entry; |
13 | use 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; | |||
10 | class AnnotationRepository extends EntityRepository | 10 | class 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 | } |