|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of the Symfony package. |
| 5 | + * |
| 6 | + * (c) Fabien Potencier <[email protected]> |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view the LICENSE |
| 9 | + * file that was distributed with this source code. |
| 10 | + */ |
| 11 | + |
| 12 | +namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\RoutingConditionServiceBundle\Controller; |
| 13 | + |
| 14 | +use Symfony\Component\HttpFoundation\Response; |
| 15 | +use Symfony\Component\Routing\Annotation\Route; |
| 16 | + |
| 17 | +class DefaultController |
| 18 | +{ |
| 19 | + #[Route( |
| 20 | + path: '/allowed/manually-tagged', |
| 21 | + condition: 'service("manually_tagged").giveMeTrue()', |
| 22 | + )] |
| 23 | + public function allowedByManuallyTagged(): Response |
| 24 | + { |
| 25 | + return new Response(); |
| 26 | + } |
| 27 | + |
| 28 | + #[Route( |
| 29 | + path: '/allowed/auto-configured', |
| 30 | + condition: 'service("auto_configured").flip(false)', |
| 31 | + )] |
| 32 | + public function allowedByAutoConfigured(): Response |
| 33 | + { |
| 34 | + return new Response(); |
| 35 | + } |
| 36 | + |
| 37 | + #[Route( |
| 38 | + path: '/allowed/auto-configured-non-aliased', |
| 39 | + condition: 'service("auto_configured_non_aliased").alwaysTrue()', |
| 40 | + )] |
| 41 | + public function allowedByAutoConfiguredNonAliased(): Response |
| 42 | + { |
| 43 | + return new Response(); |
| 44 | + } |
| 45 | + |
| 46 | + #[Route( |
| 47 | + path: '/denied/manually-tagged', |
| 48 | + condition: 'service("manually_tagged").giveMeFalse()', |
| 49 | + )] |
| 50 | + public function deniedByManuallyTagged(): Response |
| 51 | + { |
| 52 | + return new Response(); |
| 53 | + } |
| 54 | + |
| 55 | + #[Route( |
| 56 | + path: '/denied/auto-configured', |
| 57 | + condition: 'service("auto_configured").flip(true)', |
| 58 | + )] |
| 59 | + public function deniedByAutoConfigured(): Response |
| 60 | + { |
| 61 | + return new Response(); |
| 62 | + } |
| 63 | + |
| 64 | + #[Route( |
| 65 | + path: '/denied/auto-configured-non-aliased', |
| 66 | + condition: 'service("auto_configured_non_aliased").alwaysFalse()', |
| 67 | + )] |
| 68 | + public function deniedByAutoConfiguredNonAliased(): Response |
| 69 | + { |
| 70 | + return new Response(); |
| 71 | + } |
| 72 | + |
| 73 | + #[Route( |
| 74 | + path: '/denied/overridden', |
| 75 | + condition: 'service("foo").isAllowed()', |
| 76 | + )] |
| 77 | + public function deniedByOverriddenAlias(): Response |
| 78 | + { |
| 79 | + return new Response(); |
| 80 | + } |
| 81 | +} |
0 commit comments