63
63
use Symfony \Component \Routing \RouteCollection ;
64
64
use Symfony \Component \Serializer \Normalizer \AbstractNormalizer ;
65
65
use Symfony \Component \Serializer \SerializerInterface ;
66
+ use Twig \Environment ;
66
67
67
68
/**
68
69
* Algemene controller voor groepen.
@@ -82,13 +83,13 @@ abstract class AbstractGroepenController extends AbstractController implements
82
83
/** @var GroepLidRepository */
83
84
private $ groepLidRepository ;
84
85
85
- public function __construct (ManagerRegistry $ registry )
86
+ public function __construct (protected ManagerRegistry $ registry, private Environment $ twig )
86
87
{
87
- $ this ->repository = $ registry ->getRepository ($ this ->getGroepType ());
88
- $ this ->changeLogRepository = $ registry ->getRepository (
88
+ $ this ->repository = $ this -> registry ->getRepository ($ this ->getGroepType ());
89
+ $ this ->changeLogRepository = $ this -> registry ->getRepository (
89
90
ChangeLogEntry::class
90
91
);
91
- $ this ->groepLidRepository = $ registry ->getRepository (GroepLid::class);
92
+ $ this ->groepLidRepository = $ this -> registry ->getRepository (GroepLid::class);
92
93
}
93
94
94
95
/**
@@ -231,7 +232,7 @@ public function overzicht(Request $request, $soort = null)
231
232
);
232
233
// controleert rechten bekijken per groep
233
234
$ body = new GroepenView (
234
- $ this ->container -> get ( ' csr.hack. twig' ) ,
235
+ $ this ->twig ,
235
236
$ this ->repository ,
236
237
$ groepen ,
237
238
$ soortEnum ,
@@ -259,7 +260,7 @@ public function bekijken($id)
259
260
}
260
261
// controleert rechten bekijken per groep
261
262
$ body = new GroepenView (
262
- $ this ->container -> get ( ' csr.hack. twig' ) ,
263
+ $ this ->twig ,
263
264
$ this ->repository ,
264
265
$ groepen ,
265
266
$ soort ,
@@ -310,7 +311,7 @@ public function pasfotos($id)
310
311
if (!$ this ->isGranted (AbstractGroepVoter::BEKIJKEN , $ groep )) {
311
312
throw $ this ->createAccessDeniedException ();
312
313
}
313
- return new GroepPasfotosView ($ this ->container -> get ( ' csr.hack. twig' ) , $ groep );
314
+ return new GroepPasfotosView ($ this ->twig , $ groep );
314
315
}
315
316
316
317
public function lijst ($ id )
@@ -319,7 +320,7 @@ public function lijst($id)
319
320
if (!$ this ->isGranted (AbstractGroepVoter::BEKIJKEN , $ groep )) {
320
321
throw $ this ->createAccessDeniedException ();
321
322
}
322
- return new GroepLijstView ($ this ->container -> get ( ' csr.hack. twig' ) , $ groep );
323
+ return new GroepLijstView ($ this ->twig , $ groep );
323
324
}
324
325
325
326
public function stats ($ id )
@@ -332,7 +333,7 @@ public function stats($id)
332
333
$ statistieken = $ this ->repository ->getStatistieken ($ groep );
333
334
334
335
return new GroepStatistiekView (
335
- $ this ->container -> get ( ' csr.hack. twig' ) ,
336
+ $ this ->twig ,
336
337
$ groep ,
337
338
$ statistieken
338
339
);
@@ -344,7 +345,7 @@ public function emails($id)
344
345
if (!$ this ->isGranted (AbstractGroepVoter::BEKIJKEN , $ groep )) {
345
346
throw $ this ->createAccessDeniedException ();
346
347
}
347
- return new GroepEmailsView ($ this ->container -> get ( ' csr.hack. twig' ) , $ groep );
348
+ return new GroepEmailsView ($ this ->twig , $ groep );
348
349
}
349
350
350
351
public function eetwens ($ id )
@@ -353,7 +354,7 @@ public function eetwens($id)
353
354
if (!$ this ->isGranted (AbstractGroepVoter::BEKIJKEN , $ groep )) {
354
355
throw $ this ->createAccessDeniedException ();
355
356
}
356
- return new GroepEetwensView ($ this ->container -> get ( ' csr.hack. twig' ) , $ groep );
357
+ return new GroepEetwensView ($ this ->twig , $ groep );
357
358
}
358
359
359
360
public function zoeken (Request $ request , $ zoekterm = null )
@@ -503,7 +504,7 @@ public function aanmaken(Request $request, $id = null, $soort = null)
503
504
FlashType::SUCCESS ,
504
505
$ groep ::class . ' succesvol aangemaakt! '
505
506
);
506
- $ form = new GroepPreviewForm ($ this ->container -> get ( ' csr.hack. twig' ) , $ groep );
507
+ $ form = new GroepPreviewForm ($ this ->twig , $ groep );
507
508
$ view ->modal = $ form ->__toString ();
508
509
return $ view ;
509
510
} else {
@@ -743,7 +744,7 @@ public function voorbeeld($id)
743
744
if (!$ this ->isGranted (AbstractGroepVoter::BEKIJKEN , $ groep )) {
744
745
throw $ this ->createAccessDeniedException ();
745
746
}
746
- return new GroepPreviewForm ($ this ->container -> get ( ' csr.hack. twig' ) , $ groep );
747
+ return new GroepPreviewForm ($ this ->twig , $ groep );
747
748
}
748
749
749
750
/**
@@ -851,7 +852,7 @@ public function ketzer_aanmelden(EntityManagerInterface $em, $id)
851
852
$ em ->persist ($ lid );
852
853
$ em ->flush ();
853
854
$ groep ->getLeden ()->add ($ lid );
854
- return new GroepPasfotosView ($ this ->container -> get ( ' csr.hack. twig' ) , $ groep );
855
+ return new GroepPasfotosView ($ this ->twig , $ groep );
855
856
} else {
856
857
return $ form ;
857
858
}
@@ -980,7 +981,7 @@ public function ketzer_afmelden(EntityManagerInterface $em, $id, $uid = null)
980
981
$ em ->remove ($ lid );
981
982
$ em ->flush ();
982
983
983
- return new GroepView ($ this ->container -> get ( ' csr.hack. twig' ) , $ groep );
984
+ return new GroepView ($ this ->twig , $ groep );
984
985
}
985
986
986
987
public function afmelden (EntityManagerInterface $ em , $ id , $ uid )
0 commit comments