integer-net /
magento2-addtocartgraphql
| 1 | <?php |
||
| 2 | declare(strict_types=1); |
||
| 3 | |||
| 4 | namespace IntegerNet\AddToCartGraphQl\Plugin; |
||
| 5 | |||
| 6 | use Magento\Checkout\Model\Session; |
||
|
0 ignored issues
–
show
|
|||
| 7 | use Magento\Quote\Model\QuoteManagement; |
||
|
0 ignored issues
–
show
The type
Magento\Quote\Model\QuoteManagement 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 Loading history...
|
|||
| 8 | |||
| 9 | /** |
||
| 10 | * Force setting cart id for guests - this is required for graphql add to cart to work |
||
| 11 | */ |
||
| 12 | class ForceGuestCart |
||
| 13 | { |
||
| 14 | private QuoteManagement $quoteManagement; |
||
|
0 ignored issues
–
show
|
|||
| 15 | |||
| 16 | public function __construct( |
||
| 17 | QuoteManagement $quoteManagement) |
||
|
0 ignored issues
–
show
|
|||
| 18 | { |
||
|
0 ignored issues
–
show
|
|||
| 19 | $this->quoteManagement = $quoteManagement; |
||
| 20 | } |
||
| 21 | |||
| 22 | public function beforeGetQuote(Session $subject) |
||
| 23 | { |
||
| 24 | if (!($subject->getQuoteId())) { |
||
| 25 | $quoteId = $this->quoteManagement->createEmptyCart(); |
||
| 26 | $subject->setQuoteId($quoteId); |
||
| 27 | } |
||
| 28 | } |
||
| 29 | } |
||
| 30 |
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