1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Commercetools\Core\Request\Carts\Command; |
4
|
|
|
|
5
|
|
|
use Commercetools\Core\Model\Channel\ChannelReference; |
6
|
|
|
use Commercetools\Core\Model\Common\Context; |
7
|
|
|
use Commercetools\Core\Model\Common\ResourceIdentifier; |
8
|
|
|
use Commercetools\Core\Request\AbstractAction; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @package Commercetools\Core\Request\Carts\Command |
12
|
|
|
* |
13
|
|
|
* @method string getAction() |
14
|
|
|
* @method CartSetLineItemDistributionChannelAction setAction(string $action = null) |
15
|
|
|
* @method string getLineItemId() |
16
|
|
|
* @method CartSetLineItemDistributionChannelAction setLineItemId(string $lineItemId = null) |
17
|
|
|
* @method ChannelReference getDistributionChannel() |
18
|
|
|
* phpcs:disable |
19
|
|
|
* @method CartSetLineItemDistributionChannelAction setDistributionChannel(ChannelReference $distributionChannel = null) |
20
|
|
|
* phpcs:enable |
21
|
|
|
*/ |
22
|
|
|
class CartSetLineItemDistributionChannelAction extends AbstractAction |
23
|
|
|
{ |
24
|
|
|
public function fieldDefinitions() |
25
|
|
|
{ |
26
|
|
|
return [ |
27
|
|
|
'action' => [static::TYPE => 'string'], |
28
|
|
|
'lineItemId' => [static::TYPE => 'string'], |
29
|
|
|
'distributionChannel' => [static::TYPE => ChannelReference::class], |
30
|
|
|
]; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param array $data |
35
|
|
|
* @param Context|callable $context |
36
|
|
|
*/ |
37
|
|
|
public function __construct(array $data = [], $context = null) |
38
|
|
|
{ |
39
|
|
|
parent::__construct($data, $context); |
40
|
|
|
$this->setAction('setLineItemDistributionChannel'); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param String $itemLineId |
45
|
|
|
* @param ResourceIdentifier|ChannelReference $distributionChannel |
46
|
|
|
* @param Context|callable $context |
47
|
|
|
* @return CartSetLineItemDistributionChannelAction |
48
|
|
|
*/ |
49
|
|
|
public static function ofItemLineIdAndDistributionChannel($itemLineId, ChannelReference $distributionChannel, $context = null) |
50
|
|
|
{ |
51
|
|
|
return static::of($context)->setLineItemId($itemLineId)->setDistributionChannel($distributionChannel); |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|