Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Commit 31e1d9b

Browse files
authored
Merge pull request #716 from commercetools/additional-maitainance
add missing update action
2 parents bf4d5a0 + 2283fca commit 31e1d9b

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

src/Core/Builder/Update/StoresActionBuilder.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Commercetools\Core\Request\Stores\Command\StoreAddDistributionChannelAction;
88
use Commercetools\Core\Request\Stores\Command\StoreAddProductSelectionAction;
99
use Commercetools\Core\Request\Stores\Command\StoreAddSupplyChannelAction;
10+
use Commercetools\Core\Request\Stores\Command\StoreChangeProductSelectionAction;
1011
use Commercetools\Core\Request\Stores\Command\StoreRemoveDistributionChannelAction;
1112
use Commercetools\Core\Request\Stores\Command\StoreRemoveProductSelectionAction;
1213
use Commercetools\Core\Request\Stores\Command\StoreRemoveSupplyChannelAction;
@@ -53,6 +54,17 @@ public function addSupplyChannel($action = null)
5354
return $this;
5455
}
5556

57+
/**
58+
*
59+
* @param StoreChangeProductSelectionAction|callable $action
60+
* @return $this
61+
*/
62+
public function changeProductSelection($action = null)
63+
{
64+
$this->addAction($this->resolveAction(StoreChangeProductSelectionAction::class, $action));
65+
return $this;
66+
}
67+
5668
/**
5769
* @link https://docs.commercetools.com/api/projects/stores#remove-distribution-channel
5870
* @param StoreRemoveDistributionChannelAction|callable $action
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
namespace Commercetools\Core\Request\Stores\Command;
4+
5+
use Commercetools\Core\Model\Common\Context;
6+
use Commercetools\Core\Model\ProductSelection\ProductSelectionReference;
7+
use Commercetools\Core\Model\Store\ProductSelectionSetting;
8+
use Commercetools\Core\Request\AbstractAction;
9+
10+
/**
11+
* @package Commercetools\Core\Request\Stores\Command
12+
*
13+
* @method string getAction()
14+
* @method StoreChangeProductSelectionAction setAction(string $action = null)
15+
* @method ProductSelectionReference getProductSelection()
16+
* @method StoreChangeProductSelectionAction setProductSelection(ProductSelectionReference $productSelection = null)
17+
* @method bool getActive()
18+
* @method StoreChangeProductSelectionAction setActive(bool $active = null)
19+
*/
20+
class StoreChangeProductSelectionAction extends AbstractAction
21+
{
22+
public function fieldDefinitions()
23+
{
24+
return [
25+
'action' => [static::TYPE => 'string'],
26+
'productSelection' => [static::TYPE => ProductSelectionReference::class],
27+
'active' => [static::TYPE => 'bool', static::OPTIONAL => 'true'],
28+
];
29+
}
30+
31+
/**
32+
* @param array $data
33+
* @param Context|callable $context
34+
*/
35+
public function __construct(array $data = [], $context = null)
36+
{
37+
parent::__construct($data, $context);
38+
$this->setAction('changeProductSelection');
39+
}
40+
41+
/**
42+
* @param ProductSelectionSetting $productSelectionSetting
43+
* @param Context|callable $context
44+
* @return StoreChangeProductSelectionAction
45+
*/
46+
public static function ofProductSelection(ProductSelectionSetting $productSelectionSetting, $context = null)
47+
{
48+
return static::of($context)->setProductSelection($productSelectionSetting);
49+
}
50+
}

0 commit comments

Comments
 (0)