Completed
Push — master ( 72ee6d...947310 )
by Matt
09:59
created

ImageController::oldImagesShowRedirect()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Controller\Image;
4
5
use App\Entity\Image;
6
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
7
use Symfony\Component\HttpFoundation\Response;
8
use Symfony\Component\Routing\Annotation\Route;
9
10
class ImageController extends AbstractController
11
{
12
    /**
13
     * @Route("/image/{id}", name="image_show", methods={"GET"})
14
     */
15
    public function show(Image $image): Response
16
    {
17
        return $this->render('/image/show.html.twig', [
18
            'image' => $image,
19
        ]);
20
    }
21
22
    /**
23
     * @Route("/images/{id}", name="old_images_show_redirect", methods={"GET"})
24
     */
25
    public function oldImagesShowRedirect(Image $image): Response
26
    {
27
        // We used to use /images/ instead of /image/ but changed it
28
        // because that clashed with the dev firewall rule that didn't
29
        // do any authentication for /images/ as it's also the
30
        // /public/images directory.
31
        // TODO: Go through and remove all the existing image links
32
        // in the wander and image descriptions that point to
33
        // /images/ and then remove this.
34
        return $this->redirectToRoute('image_show', ['id' => $image->getId()], 302);
35
    }
36
}
37