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 CartSetLineItemSupplyChannelAction setAction(string $action = null) |
15
|
|
|
* @method string getLineItemId() |
16
|
|
|
* @method CartSetLineItemSupplyChannelAction setLineItemId(string $lineItemId = null) |
17
|
|
|
* @method ChannelReference getSupplyChannel() |
18
|
|
|
* @method CartSetLineItemSupplyChannelAction setSupplyChannel(ChannelReference $supplyChannel = null) |
19
|
|
|
*/ |
20
|
|
|
class CartSetLineItemSupplyChannelAction extends AbstractAction |
21
|
|
|
{ |
22
|
|
|
public function fieldDefinitions() |
23
|
|
|
{ |
24
|
|
|
return [ |
25
|
|
|
'action' => [static::TYPE => 'string'], |
26
|
|
|
'lineItemId' => [static::TYPE => 'string'], |
27
|
|
|
'supplyChannel' => [static::TYPE => ChannelReference::class], |
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('setLineItemSupplyChannel'); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param String $itemLineId |
43
|
|
|
* @param ResourceIdentifier|ChannelReference $supplyChannel |
44
|
|
|
* @param Context|callable $context |
45
|
|
|
* @return CartSetLineItemSupplyChannelAction |
46
|
|
|
*/ |
47
|
|
|
public static function ofItemLineIdAndSupplyChannel($itemLineId, ChannelReference $supplyChannel, $context = null) |
48
|
|
|
{ |
49
|
|
|
return static::of($context)->setLineItemId($itemLineId)->setSupplyChannel($supplyChannel); |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|