1414
1515namespace Novactive \Bundle \eZProtectedContentBundle \Listener ;
1616
17- use Doctrine \ORM \EntityManagerInterface ;
1817use Ibexa \Contracts \Core \Repository \PermissionResolver ;
1918use Ibexa \Core \MVC \Symfony \Event \PreContentViewEvent ;
2019use Ibexa \Core \MVC \Symfony \View \ContentView ;
2120use Novactive \Bundle \eZProtectedContentBundle \Entity \ProtectedAccess ;
2221use Novactive \Bundle \eZProtectedContentBundle \Form \RequestProtectedAccessType ;
22+ use Novactive \Bundle \eZProtectedContentBundle \Repository \ProtectedAccessRepository ;
2323use Symfony \Component \Form \FormFactoryInterface ;
2424use Symfony \Component \HttpFoundation \RequestStack ;
2525
@@ -31,9 +31,9 @@ class PreContentView
3131 private $ permissionResolver ;
3232
3333 /**
34- * @var EntityManagerInterface
34+ * @var ProtectedAccessRepository
3535 */
36- private $ entityManager ;
36+ private $ protectedAccessRepository ;
3737
3838 /**
3939 * @var FormFactoryInterface
@@ -47,12 +47,12 @@ class PreContentView
4747
4848 public function __construct (
4949 PermissionResolver $ permissionResolver ,
50- EntityManagerInterface $ manager ,
50+ ProtectedAccessRepository $ protectedAccessRepository ,
5151 FormFactoryInterface $ factory ,
5252 RequestStack $ requestStack
5353 ) {
5454 $ this ->permissionResolver = $ permissionResolver ;
55- $ this ->entityManager = $ manager ;
55+ $ this ->protectedAccessRepository = $ protectedAccessRepository ;
5656 $ this ->formFactory = $ factory ;
5757 $ this ->requestStack = $ requestStack ;
5858 }
@@ -74,7 +74,7 @@ public function onPreContentView(PreContentViewEvent $event): void
7474
7575 $ content = $ contentView ->getContent ();
7676
77- $ protections = $ this ->entityManager -> getRepository (ProtectedAccess::class) ->findByContent ($ content );
77+ $ protections = $ this ->protectedAccessRepository ->findByContent ($ content );
7878
7979 if (0 === count ($ protections )) {
8080 return ;
0 commit comments