| 1 | <?php |
||
| 11 | class TestController extends Controller |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @Route("/ready") |
||
| 15 | */ |
||
| 16 | public function foobarAction() |
||
| 17 | { |
||
| 18 | return new Response('MediaMonks Functional Test App Ready'); |
||
| 19 | } |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @Route("/twig") |
||
| 23 | * @return Response |
||
| 24 | */ |
||
| 25 | public function twigAction() |
||
| 26 | { |
||
| 27 | return $this->render( |
||
| 28 | 'AppBundle:Test:index.html.twig', |
||
| 29 | [ |
||
| 30 | 'media' => $this->getDoctrine()->getManager()->find('AppBundle:Media', 1), |
||
| 31 | ] |
||
| 32 | ); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @Route("/api") |
||
| 37 | * @return Response |
||
| 38 | */ |
||
| 39 | public function apiAction() |
||
| 40 | { |
||
| 41 | $media = $this->getDoctrine()->getManager()->find('AppBundle:Media', 1); |
||
| 42 | |||
| 43 | $url = $this->get('mediamonks.sonata_media.generator.url_generator.image')->generate( |
||
| 44 | $media, |
||
| 45 | new ImageParameterBag(400, 300) |
||
| 46 | ); |
||
| 47 | |||
| 48 | return new JsonResponse(['url' => $url]); |
||
| 49 | } |
||
| 50 | } |
||
| 51 |