1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Service; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
|
|
|
|
6
|
|
|
use Symfony\Component\Security\Core\Security; |
|
|
|
|
7
|
|
|
use Doctrine\ORM\QueryBuilder; |
|
|
|
|
8
|
|
|
use Symfony\Component\HttpFoundation\RequestStack; |
|
|
|
|
9
|
|
|
|
10
|
|
|
class OrderService |
11
|
|
|
{ |
12
|
|
|
private $request; |
13
|
|
|
|
14
|
|
|
public function __construct( |
15
|
|
|
private EntityManagerInterface $manager, |
16
|
|
|
private Security $security, |
17
|
|
|
private PeopleService $PeopleService, |
|
|
|
|
18
|
|
|
RequestStack $requestStack |
19
|
|
|
|
20
|
|
|
) { |
21
|
|
|
$this->request = $requestStack->getCurrentRequest(); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
public function secutiryFilter(QueryBuilder $queryBuilder, $resourceClass = null, $applyTo = null, $rootAlias = null): void |
|
|
|
|
25
|
|
|
{ |
26
|
|
|
$companies = $this->PeopleService->getMyCompanies(); |
27
|
|
|
|
28
|
|
|
if ($invoice = $this->request->query->get('invoiceId', null)) { |
29
|
|
|
$queryBuilder->join(sprintf('%s.invoice', $rootAlias), 'OrderInvoice'); |
30
|
|
|
$queryBuilder->andWhere(sprintf('OrderInvoice.invoice IN(:invoice)', $rootAlias, $rootAlias)); |
31
|
|
|
$queryBuilder->setParameter('invoice', $invoice); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
$queryBuilder->andWhere(sprintf('%s.client IN(:companies) OR %s.provider IN(:companies)', $rootAlias, $rootAlias)); |
35
|
|
|
$queryBuilder->setParameter('companies', $companies); |
36
|
|
|
|
37
|
|
|
if ($provider = $this->request->query->get('provider', null)) { |
38
|
|
|
$queryBuilder->andWhere(sprintf('%s.provider IN(:provider)', $rootAlias)); |
39
|
|
|
$queryBuilder->setParameter('provider', preg_replace("/[^0-9]/", "", $provider)); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
if ($client = $this->request->query->get('client', null)) { |
43
|
|
|
$queryBuilder->andWhere(sprintf('%s.client IN(:client)', $rootAlias)); |
44
|
|
|
$queryBuilder->setParameter('client', preg_replace("/[^0-9]/", "", $client)); |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|
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