1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Controller; |
4
|
|
|
|
5
|
|
|
use ControleOnline\Entity\Device; |
|
|
|
|
6
|
|
|
use Symfony\Component\HttpFoundation\Request; |
|
|
|
|
7
|
|
|
use Symfony\Component\HttpFoundation\JsonResponse; |
|
|
|
|
8
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
|
|
|
|
9
|
|
|
use Symfony\Component\Routing\Annotation\Route; |
|
|
|
|
10
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; |
|
|
|
|
11
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
|
|
|
|
12
|
|
|
use ControleOnline\Entity\People; |
|
|
|
|
13
|
|
|
use ControleOnline\Service\ProductService; |
14
|
|
|
|
15
|
|
|
class PurchasingSuggestionController extends AbstractController |
16
|
|
|
{ |
17
|
|
|
public function __construct( |
18
|
|
|
private EntityManagerInterface $manager, |
19
|
|
|
private ProductService $productService |
20
|
|
|
) {} |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @Route("/products/purchasing-suggestion", name="purchasing_suggestion", methods={"GET"}) |
24
|
|
|
* @Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") |
25
|
|
|
*/ |
26
|
|
|
public function getPurchasingSuggestion(Request $request): JsonResponse |
27
|
|
|
{ |
28
|
|
|
$company = $this->manager->getRepository(People::class)->find($request->get('company')); |
29
|
|
|
$data = $this->productService->getPurchasingSuggestion($company); |
30
|
|
|
return new JsonResponse($data); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @Route("/products/purchasing-suggestion/print", name="purchasing_suggestion_print", methods={"POST"}) |
35
|
|
|
* @Security("is_granted('ROLE_ADMIN') or is_granted('ROLE_CLIENT')") |
36
|
|
|
*/ |
37
|
|
|
public function printPurchasingSuggestion(Request $request): JsonResponse |
38
|
|
|
{ |
39
|
|
|
$data = json_decode($request->getContent(), true); |
40
|
|
|
$printType = $data['print-type']; |
41
|
|
|
$deviceType = $data['device-type']; |
42
|
|
|
$company = $this->manager->getRepository(People::class)->find($data['people']); |
43
|
|
|
$printData = $this->productService->purchasingSuggestionPrintData($company, $printType, $deviceType); |
44
|
|
|
return new JsonResponse($printData); |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths