1 | <?php |
||
2 | |||
3 | namespace DnVariantSwitch\Services; |
||
4 | |||
5 | use Shopware\Bundle\StoreFrontBundle\Service\AdditionalTextServiceInterface; |
||
0 ignored issues
–
show
|
|||
6 | use Shopware\Bundle\StoreFrontBundle\Service\ContextServiceInterface; |
||
0 ignored issues
–
show
The type
Shopware\Bundle\StoreFro...ContextServiceInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
7 | use Shopware\Bundle\StoreFrontBundle\Service\ListProductServiceInterface; |
||
0 ignored issues
–
show
The type
Shopware\Bundle\StoreFro...ProductServiceInterface was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
8 | use Shopware\Components\Model\ModelManager; |
||
0 ignored issues
–
show
The type
Shopware\Components\Model\ModelManager was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
9 | |||
10 | /** |
||
11 | * Class VariantSwitch |
||
12 | * @package DnVariantSwitch\Services |
||
13 | */ |
||
14 | class VariantSwitch implements VariantSwitchInterface |
||
15 | { |
||
16 | |||
17 | /** @var ModelManager */ |
||
18 | private $models; |
||
19 | |||
20 | /** @var \Enlight_Components_Session_Namespace */ |
||
0 ignored issues
–
show
The type
Enlight_Components_Session_Namespace was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
21 | private $session; |
||
22 | |||
23 | /** @var ContextServiceInterface */ |
||
24 | private $context; |
||
25 | |||
26 | /** @var ListProductServiceInterface */ |
||
27 | private $listProductService; |
||
28 | |||
29 | /** @var AdditionalTextServiceInterface */ |
||
30 | private $additionalTextService; |
||
31 | |||
32 | /** |
||
33 | * VariantSwitch constructor. |
||
34 | * @param ModelManager $models |
||
35 | * @param \Enlight_Components_Session_Namespace $session |
||
36 | * @param ContextServiceInterface $contextService |
||
37 | * @param ListProductServiceInterface $listProductService |
||
38 | * @param AdditionalTextServiceInterface $additionalTextService |
||
39 | */ |
||
40 | public function __construct( |
||
41 | ModelManager $models, |
||
42 | \Enlight_Components_Session_Namespace $session, |
||
43 | ContextServiceInterface $contextService, |
||
44 | ListProductServiceInterface $listProductService, |
||
45 | AdditionalTextServiceInterface $additionalTextService |
||
46 | ) |
||
47 | { |
||
48 | $this->models = $models; |
||
49 | $this->session = $session; |
||
50 | $this->context = $contextService; |
||
51 | $this->listProductService = $listProductService; |
||
52 | $this->additionalTextService = $additionalTextService; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @inheritdoc |
||
57 | */ |
||
58 | public function switchVariant( |
||
59 | $number, |
||
60 | $basketID, |
||
61 | \sBasket $sBasket, |
||
0 ignored issues
–
show
The type
sBasket was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
62 | $quantity = 1 |
||
63 | ) |
||
64 | { |
||
65 | /** @var \Shopware\Models\Order\Basket $basket */ |
||
66 | $basket = $this->models->getRepository('Shopware\Models\Order\Basket')->find($basketID); |
||
67 | |||
68 | if (!$basket || $basket->getSessionId() !== $this->session->get('sessionId')) { |
||
0 ignored issues
–
show
|
|||
69 | return; |
||
70 | } |
||
71 | |||
72 | $basket->setOrderNumber($number); |
||
73 | |||
74 | $context = $this->context->getProductContext(); |
||
75 | $product = $this->listProductService->get($number, $context); |
||
76 | /** @var \Shopware\Bundle\StoreFrontBundle\Struct\ListProduct $product */ |
||
77 | $product = $this->additionalTextService->buildAdditionalText($product, $context); |
||
78 | |||
79 | $basket->setEsdArticle($product->getEsd() ? 1 : 0); |
||
80 | $basket->setArticleName($product->getName() . ' ' . $product->getAdditional()); |
||
81 | |||
82 | $this->models->persist($basket); |
||
83 | $this->models->flush(); |
||
84 | |||
85 | $sBasket->sUpdateArticle($basketID, $quantity); |
||
86 | } |
||
87 | |||
88 | } |
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