Test Setup Failed
Branch master (1b2352)
by Valery
09:42
created

PhotoController::sort()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Controller\User\Ajax;
6
7
use App\Controller\AbstractPhotoController;
8
use App\Controller\AjaxController;
9
use App\Entity\Property;
10
use App\Service\FileUploader;
11
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
12
use Symfony\Component\HttpFoundation\JsonResponse;
13
use Symfony\Component\HttpFoundation\Request;
14
use Symfony\Component\Routing\Annotation\Route;
15
16
final class PhotoController extends AbstractPhotoController implements AjaxController
17
{
18
    /**
19
     * @Route("/user/photo/{id<\d+>}/upload", name="user_photo_upload", methods={"POST"})
20
     * @IsGranted("PROPERTY_EDIT", subject="property", message="You cannot change this property.")
21
     */
22
    public function upload(Property $property, Request $request, FileUploader $fileUploader): JsonResponse
23
    {
24
        return $this->uploadPhoto($property, $request, $fileUploader);
25
    }
26
27
    /**
28
     * Sort photos.
29
     *
30
     * @Route("/user/photo/{id<\d+>}/sort",methods={"POST"}, name="user_photo_sort")
31
     * @IsGranted("PROPERTY_EDIT", subject="property", message="You cannot change this property.")
32
     */
33
    public function sort(Request $request, Property $property): JsonResponse
34
    {
35
        return $this->sortPhotos($request, $property);
36
    }
37
}
38