Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- declare(strict_types=1);
- namespace App\Controller;
- use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
- use Symfony\Component\Routing\Annotation\Route;
- use App\Model\Acme;
- use App\Model\Foo;
- /**
- * @Route(
- * name="app_example_route",
- * path="/example/{acme_id}/{foo_id}",
- * defaults={"foo_id" = null}
- * )
- * @ParamConverter("acme", class=Acme::class, options={
- * "id" = "acme_id"
- * })
- * @ParamConverter("foo", class=Foo::class, isOptional="true", options={
- * "id" = "foo_id"
- * })
- */
- public function indexAction(Acme $amce, ?Foo $foo): void
- {
- echo 'The foo class is nullable';
- }
Add Comment
Please, Sign In to add comment