1 | <?php |
||||
2 | |||||
3 | /* |
||||
4 | * This file has been created by developers from BitBag. |
||||
5 | * Feel free to contact us once you face any issues or want to start |
||||
6 | * another great project. |
||||
7 | * You can find more information about us on https://bitbag.shop and write us |
||||
8 | * an email on [email protected]. |
||||
9 | */ |
||||
10 | |||||
11 | declare(strict_types=1); |
||||
12 | |||||
13 | namespace BitBag\SyliusElasticsearchPlugin\Repository; |
||||
14 | |||||
15 | use Doctrine\ORM\EntityRepository; |
||||
16 | use Sylius\Component\Core\Model\OrderInterface; |
||||
17 | use Sylius\Component\Core\Model\ProductVariantInterface; |
||||
18 | |||||
19 | class OrderItemRepository implements OrderItemRepositoryInterface |
||||
20 | { |
||||
21 | /** @var OrderItemRepositoryInterface */ |
||||
22 | private $baseOrderItemRepository; |
||||
23 | |||||
24 | public function __construct(EntityRepository $baseOrderItemRepository) |
||||
25 | { |
||||
26 | $this->baseOrderItemRepository = $baseOrderItemRepository; |
||||
0 ignored issues
–
show
|
|||||
27 | } |
||||
28 | |||||
29 | public function countByVariant(ProductVariantInterface $variant, array $orderStates = []): int |
||||
30 | { |
||||
31 | if (empty($orderStates)) { |
||||
32 | $orderStates = [OrderInterface::STATE_CANCELLED, OrderInterface::STATE_CART]; |
||||
33 | } |
||||
34 | |||||
35 | return (int) ($this->baseOrderItemRepository |
||||
36 | ->createQueryBuilder('oi') |
||||
0 ignored issues
–
show
The method
createQueryBuilder() does not exist on BitBag\SyliusElasticsear...ItemRepositoryInterface .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||||
37 | ->select('SUM(oi.quantity)') |
||||
38 | ->join('oi.order', 'o') |
||||
39 | ->where('oi.variant = :variant') |
||||
40 | ->andWhere('o.state NOT IN (:states)') |
||||
41 | ->setParameter('variant', $variant) |
||||
42 | ->setParameter('states', $orderStates) |
||||
43 | ->getQuery() |
||||
44 | ->getSingleScalarResult()); |
||||
45 | } |
||||
46 | } |
||||
47 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..