From 1c880883e22dcc80c5dfd3367c43fd30d01aa50e Mon Sep 17 00:00:00 2001 From: Yassine Guedidi Date: Thu, 25 Aug 2022 22:25:41 +0200 Subject: [PATCH] Migrate ParamConverter class parameter --- .../WallabagAnnotationController.php | 4 ++-- .../Controller/AnnotationRestController.php | 4 ++-- .../CoreBundle/Controller/FeedController.php | 10 +++++----- .../UsernameFeedTokenConverterTest.php | 18 +++++++++--------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php index c494e056f..4fd3023a6 100644 --- a/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php +++ b/src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php @@ -72,7 +72,7 @@ class WallabagAnnotationController extends AbstractFOSRestController * * @see Wallabag\ApiBundle\Controller\WallabagRestController * - * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation") + * @ParamConverter("annotation", class="Wallabag\AnnotationBundle\Entity\Annotation") * * @return JsonResponse */ @@ -104,7 +104,7 @@ class WallabagAnnotationController extends AbstractFOSRestController * * @see Wallabag\ApiBundle\Controller\WallabagRestController * - * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation") + * @ParamConverter("annotation", class="Wallabag\AnnotationBundle\Entity\Annotation") * * @return JsonResponse */ diff --git a/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php b/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php index 66693189a..e83e2eba8 100644 --- a/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php +++ b/src/Wallabag/ApiBundle/Controller/AnnotationRestController.php @@ -63,7 +63,7 @@ class AnnotationRestController extends WallabagRestController * } * ) * - * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation") + * @ParamConverter("annotation", class="Wallabag\AnnotationBundle\Entity\Annotation") * * @return JsonResponse */ @@ -86,7 +86,7 @@ class AnnotationRestController extends WallabagRestController * } * ) * - * @ParamConverter("annotation", class="WallabagAnnotationBundle:Annotation") + * @ParamConverter("annotation", class="Wallabag\AnnotationBundle\Entity\Annotation") * * @return JsonResponse */ diff --git a/src/Wallabag/CoreBundle/Controller/FeedController.php b/src/Wallabag/CoreBundle/Controller/FeedController.php index c24876695..ae68356fa 100644 --- a/src/Wallabag/CoreBundle/Controller/FeedController.php +++ b/src/Wallabag/CoreBundle/Controller/FeedController.php @@ -25,7 +25,7 @@ class FeedController extends Controller * * @Route("/feed/{username}/{token}/unread/{page}", name="unread_feed", defaults={"page"=1, "_format"="xml"}) * - * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter") + * @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter") * * @param $page * @@ -41,7 +41,7 @@ class FeedController extends Controller * * @Route("/feed/{username}/{token}/archive/{page}", name="archive_feed", defaults={"page"=1, "_format"="xml"}) * - * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter") + * @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter") * * @param $page * @@ -57,7 +57,7 @@ class FeedController extends Controller * * @Route("/feed/{username}/{token}/starred/{page}", name="starred_feed", defaults={"page"=1, "_format"="xml"}) * - * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter") + * @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter") * * @param $page * @@ -73,7 +73,7 @@ class FeedController extends Controller * * @Route("/feed/{username}/{token}/all/{page}", name="all_feed", defaults={"page"=1, "_format"="xml"}) * - * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter") + * @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter") * * @return \Symfony\Component\HttpFoundation\Response */ @@ -87,7 +87,7 @@ class FeedController extends Controller * * @Route("/feed/{username}/{token}/tags/{slug}/{page}", name="tag_feed", defaults={"page"=1, "_format"="xml"}) * - * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_feed_token_converter") + * @ParamConverter("user", class="Wallabag\UserBundle\Entity\User", converter="username_feed_token_converter") * @ParamConverter("tag", options={"mapping": {"slug": "slug"}}) * * @return \Symfony\Component\HttpFoundation\Response diff --git a/tests/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverterTest.php b/tests/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverterTest.php index af009b8a1..f6533714d 100644 --- a/tests/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverterTest.php +++ b/tests/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverterTest.php @@ -104,7 +104,7 @@ class UsernameFeedTokenConverterTest extends TestCase $em->expects($this->once()) ->method('getClassMetadata') - ->with('WallabagUserBundle:User') + ->with(User::class) ->willReturn($meta); $registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry') @@ -117,10 +117,10 @@ class UsernameFeedTokenConverterTest extends TestCase $registry->expects($this->once()) ->method('getManagerForClass') - ->with('WallabagUserBundle:User') + ->with(User::class) ->willReturn($em); - $params = new ParamConverter(['class' => 'WallabagUserBundle:User']); + $params = new ParamConverter(['class' => User::class]); $converter = new UsernameFeedTokenConverter($registry); $this->assertTrue($converter->supports($params)); @@ -156,7 +156,7 @@ class UsernameFeedTokenConverterTest extends TestCase $em->expects($this->once()) ->method('getRepository') - ->with('WallabagUserBundle:User') + ->with(User::class) ->willReturn($repo); $registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry') @@ -165,10 +165,10 @@ class UsernameFeedTokenConverterTest extends TestCase $registry->expects($this->once()) ->method('getManagerForClass') - ->with('WallabagUserBundle:User') + ->with(User::class) ->willReturn($em); - $params = new ParamConverter(['class' => 'WallabagUserBundle:User']); + $params = new ParamConverter(['class' => User::class]); $converter = new UsernameFeedTokenConverter($registry); $request = new Request([], [], ['username' => 'test', 'token' => 'test']); @@ -194,7 +194,7 @@ class UsernameFeedTokenConverterTest extends TestCase $em->expects($this->once()) ->method('getRepository') - ->with('WallabagUserBundle:User') + ->with(User::class) ->willReturn($repo); $registry = $this->getMockBuilder('Doctrine\Common\Persistence\ManagerRegistry') @@ -203,10 +203,10 @@ class UsernameFeedTokenConverterTest extends TestCase $registry->expects($this->once()) ->method('getManagerForClass') - ->with('WallabagUserBundle:User') + ->with(User::class) ->willReturn($em); - $params = new ParamConverter(['class' => 'WallabagUserBundle:User', 'name' => 'user']); + $params = new ParamConverter(['class' => User::class, 'name' => 'user']); $converter = new UsernameFeedTokenConverter($registry); $request = new Request([], [], ['username' => 'test', 'token' => 'test']);