Skip to content

Commit 0d96417

Browse files
committed
Fix twig alias
De twig alias bestond al, maar was private. Deze config werkte dus niet waardoor het niet gegarandeerd is dat twig ook in de container zit. Fix dit door een nieuwe publieke alias `csr.hack.twig` te maken (want het is een hack). Dit zou niet nodig moeten zijn en kan weggegooid worden ~wanneer~ als we de ContainerFacade voorgoed uit de code verbannen.
1 parent ed9edab commit 0d96417

File tree

6 files changed

+25
-23
lines changed

6 files changed

+25
-23
lines changed

config/packages/monolog.yaml

+8-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ when@dev:
99
type: stream
1010
path: '%kernel.logs_dir%/%kernel.environment%.log'
1111
level: debug
12-
channels: ['!event']
12+
channels: ['!event', '!doctrine']
1313
# uncomment to get logging in your browser
1414
# you may have to allow bigger header sizes in your Web server configuration
1515
#firephp:
@@ -19,9 +19,14 @@ when@dev:
1919
# type: chromephp
2020
# level: info
2121
console:
22+
type: fingers_crossed
23+
action_level: error
24+
handler: console_nested
25+
excluded_http_codes: [404, 405]
26+
channels: ['!event']
27+
console_nested:
2228
type: console
23-
process_psr_3_messages: false
24-
channels: ['!event', '!doctrine', '!console']
29+
level: debug
2530

2631
when@test:
2732
monolog:

config/services.yaml

+3-6
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,9 @@ services:
102102
class: Symfony\Component\Security\Core\Authorization\AuthorizationChecker
103103
public: true
104104

105-
# Sta gebruik van twig overal toe.
106-
# Dit is een tijdelijke oplossing en moet er tzt weer uit gezet worden.
107-
# Voor nu is het makkelijk om overal templates aan te kunnen roepen en is het in ieder geval
108-
# beter dan html genereren in PHP code op deze plekken
109-
Twig\Environment:
110-
alias: twig
105+
# FIXME: Verwijder zodra ContainerFacade weg is
106+
csr.hack.twig:
107+
alias: Twig\Environment
111108
public: true
112109

113110
CsrDelft\view\bbcode\CsrBB:

lib/controller/groepen/AbstractGroepenController.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public function overzicht(Request $request, $soort = null)
231231
);
232232
// controleert rechten bekijken per groep
233233
$body = new GroepenView(
234-
$this->container->get('twig'),
234+
$this->container->get('csr.hack.twig'),
235235
$this->repository,
236236
$groepen,
237237
$soortEnum,
@@ -259,7 +259,7 @@ public function bekijken($id)
259259
}
260260
// controleert rechten bekijken per groep
261261
$body = new GroepenView(
262-
$this->container->get('twig'),
262+
$this->container->get('csr.hack.twig'),
263263
$this->repository,
264264
$groepen,
265265
$soort,
@@ -310,7 +310,7 @@ public function pasfotos($id)
310310
if (!$this->isGranted(AbstractGroepVoter::BEKIJKEN, $groep)) {
311311
throw $this->createAccessDeniedException();
312312
}
313-
return new GroepPasfotosView($this->container->get('twig'), $groep);
313+
return new GroepPasfotosView($this->container->get('csr.hack.twig'), $groep);
314314
}
315315

316316
public function lijst($id)
@@ -319,7 +319,7 @@ public function lijst($id)
319319
if (!$this->isGranted(AbstractGroepVoter::BEKIJKEN, $groep)) {
320320
throw $this->createAccessDeniedException();
321321
}
322-
return new GroepLijstView($this->container->get('twig'), $groep);
322+
return new GroepLijstView($this->container->get('csr.hack.twig'), $groep);
323323
}
324324

325325
public function stats($id)
@@ -332,7 +332,7 @@ public function stats($id)
332332
$statistieken = $this->repository->getStatistieken($groep);
333333

334334
return new GroepStatistiekView(
335-
$this->container->get('twig'),
335+
$this->container->get('csr.hack.twig'),
336336
$groep,
337337
$statistieken
338338
);
@@ -344,7 +344,7 @@ public function emails($id)
344344
if (!$this->isGranted(AbstractGroepVoter::BEKIJKEN, $groep)) {
345345
throw $this->createAccessDeniedException();
346346
}
347-
return new GroepEmailsView($this->container->get('twig'), $groep);
347+
return new GroepEmailsView($this->container->get('csr.hack.twig'), $groep);
348348
}
349349

350350
public function eetwens($id)
@@ -353,7 +353,7 @@ public function eetwens($id)
353353
if (!$this->isGranted(AbstractGroepVoter::BEKIJKEN, $groep)) {
354354
throw $this->createAccessDeniedException();
355355
}
356-
return new GroepEetwensView($this->container->get('twig'), $groep);
356+
return new GroepEetwensView($this->container->get('csr.hack.twig'), $groep);
357357
}
358358

359359
public function zoeken(Request $request, $zoekterm = null)
@@ -503,7 +503,7 @@ public function aanmaken(Request $request, $id = null, $soort = null)
503503
FlashType::SUCCESS,
504504
$groep::class . ' succesvol aangemaakt!'
505505
);
506-
$form = new GroepPreviewForm($this->container->get('twig'), $groep);
506+
$form = new GroepPreviewForm($this->container->get('csr.hack.twig'), $groep);
507507
$view->modal = $form->__toString();
508508
return $view;
509509
} else {
@@ -743,7 +743,7 @@ public function voorbeeld($id)
743743
if (!$this->isGranted(AbstractGroepVoter::BEKIJKEN, $groep)) {
744744
throw $this->createAccessDeniedException();
745745
}
746-
return new GroepPreviewForm($this->container->get('twig'), $groep);
746+
return new GroepPreviewForm($this->container->get('csr.hack.twig'), $groep);
747747
}
748748

749749
/**
@@ -851,7 +851,7 @@ public function ketzer_aanmelden(EntityManagerInterface $em, $id)
851851
$em->persist($lid);
852852
$em->flush();
853853
$groep->getLeden()->add($lid);
854-
return new GroepPasfotosView($this->container->get('twig'), $groep);
854+
return new GroepPasfotosView($this->container->get('csr.hack.twig'), $groep);
855855
} else {
856856
return $form;
857857
}
@@ -980,7 +980,7 @@ public function ketzer_afmelden(EntityManagerInterface $em, $id, $uid = null)
980980
$em->remove($lid);
981981
$em->flush();
982982

983-
return new GroepView($this->container->get('twig'), $groep);
983+
return new GroepView($this->container->get('csr.hack.twig'), $groep);
984984
}
985985

986986
public function afmelden(EntityManagerInterface $em, $id, $uid)

lib/controller/groepen/BesturenController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function overzicht(Request $request, $soort = null)
3838
);
3939
// controleert rechten bekijken per groep
4040
$body = new GroepenView(
41-
$this->container->get('twig'),
41+
$this->container->get('csr.hack.twig'),
4242
$this->repository,
4343
$groepen,
4444
null,

lib/entity/profiel/Profiel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ public function getLink($vorm = 'civitas'): string
750750
$naam .
751751
'</a></span>';
752752
} elseif ($vorm === 'leeg') {
753-
$twig = ContainerFacade::getContainer()->get('twig');
753+
$twig = ContainerFacade::getContainer()->get('csr.hack.twig');
754754

755755
return $twig->render('profiel/kaartje.html.twig', ['profiel' => $this]);
756756
}

lib/view/toestemming/ToestemmingModalForm.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function __construct(
6060
}
6161
}
6262

63-
$twig = ContainerFacade::getContainer()->get('twig');
63+
$twig = ContainerFacade::getContainer()->get('csr.hack.twig');
6464

6565
$this->addFields([
6666
new HtmlComment(

0 commit comments

Comments
 (0)