|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @author @jenschude <[email protected]> |
|
4
|
|
|
*/ |
|
5
|
|
|
|
|
6
|
|
|
namespace Commercetools\Core\Request\Orders\Command; |
|
7
|
|
|
|
|
8
|
|
|
use Commercetools\Core\Model\Common\Context; |
|
9
|
|
|
use Commercetools\Core\Model\Order\DeliveryItemCollection; |
|
10
|
|
|
use Commercetools\Core\Request\AbstractAction; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* @package Commercetools\Core\Request\Orders\Command |
|
14
|
|
|
* |
|
15
|
|
|
* @method string getAction() |
|
16
|
|
|
* @method OrderSetParcelItemsAction setAction(string $action = null) |
|
17
|
|
|
* @method string getParcelId() |
|
18
|
|
|
* @method OrderSetParcelItemsAction setParcelId(string $parcelId = null) |
|
19
|
|
|
* @method DeliveryItemCollection getItems() |
|
20
|
|
|
* @method OrderSetParcelItemsAction setItems(DeliveryItemCollection $items = null) |
|
21
|
|
|
*/ |
|
22
|
|
|
class OrderSetParcelItemsAction extends AbstractAction |
|
23
|
|
|
{ |
|
24
|
2 |
|
public function fieldDefinitions() |
|
25
|
|
|
{ |
|
26
|
|
|
return [ |
|
27
|
2 |
|
'action' => [static::TYPE => 'string'], |
|
28
|
2 |
|
'parcelId' => [static::TYPE => 'string'], |
|
29
|
2 |
|
'items' => [static::TYPE => DeliveryItemCollection::class] |
|
30
|
|
|
]; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param string $parcelId |
|
35
|
|
|
* @param Context|callable $context |
|
36
|
|
|
* @return OrderSetParcelItemsAction |
|
37
|
|
|
*/ |
|
38
|
1 |
|
public static function ofParcel($parcelId, $context = null) |
|
39
|
|
|
{ |
|
40
|
1 |
|
return static::of($context)->setParcelId($parcelId); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @param array $data |
|
45
|
|
|
* @param Context|callable $context |
|
46
|
|
|
*/ |
|
47
|
2 |
|
public function __construct(array $data = [], $context = null) |
|
48
|
|
|
{ |
|
49
|
2 |
|
parent::__construct($data, $context); |
|
50
|
2 |
|
$this->setAction('setParcelItems'); |
|
51
|
2 |
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|