Guest User

Untitled

a guest
Jan 22nd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. <?php
  2.  
  3. declare(strict_types=1);
  4.  
  5. namespace App\Controller;
  6.  
  7. use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. use App\Model\Acme;
  10. use App\Model\Foo;
  11.  
  12. /**
  13. * @Route(
  14. * name="app_example_route",
  15. * path="/example/{acme_id}/{foo_id}",
  16. * defaults={"foo_id" = null}
  17. * )
  18. * @ParamConverter("acme", class=Acme::class, options={
  19. * "id" = "acme_id"
  20. * })
  21. * @ParamConverter("foo", class=Foo::class, isOptional="true", options={
  22. * "id" = "foo_id"
  23. * })
  24. */
  25. public function indexAction(Acme $amce, ?Foo $foo): void
  26. {
  27. echo 'The foo class is nullable';
  28. }
Add Comment
Please, Sign In to add comment