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 OrderSetDeliveryItemsAction setAction(string $action = null) |
17
|
|
|
* @method string getDeliveryId() |
18
|
|
|
* @method OrderSetDeliveryItemsAction setDeliveryId(string $deliveryId = null) |
19
|
|
|
* @method DeliveryItemCollection getItems() |
20
|
|
|
* @method OrderSetDeliveryItemsAction setItems(DeliveryItemCollection $items = null) |
21
|
|
|
*/ |
22
|
|
|
class OrderSetDeliveryItemsAction extends AbstractAction |
23
|
|
|
{ |
24
|
2 |
|
public function fieldDefinitions() |
25
|
|
|
{ |
26
|
|
|
return [ |
27
|
2 |
|
'action' => [static::TYPE => 'string'], |
28
|
2 |
|
'deliveryId' => [static::TYPE => 'string'], |
29
|
2 |
|
'items' => [static::TYPE => DeliveryItemCollection::class] |
30
|
|
|
]; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param string $deliveryId |
35
|
|
|
* @param DeliveryItemCollection $items |
36
|
|
|
* @param Context|callable $context |
37
|
|
|
* @return OrderSetDeliveryItemsAction |
38
|
|
|
*/ |
39
|
1 |
|
public static function ofDeliveryAndItems($deliveryId, DeliveryItemCollection $items, $context = null) |
40
|
|
|
{ |
41
|
1 |
|
return static::of($context)->setDeliveryId($deliveryId)->setItems($items); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @param array $data |
46
|
|
|
* @param Context|callable $context |
47
|
|
|
*/ |
48
|
2 |
|
public function __construct(array $data = [], $context = null) |
49
|
|
|
{ |
50
|
2 |
|
parent::__construct($data, $context); |
51
|
2 |
|
$this->setAction('setDeliveryItems'); |
52
|
2 |
|
} |
53
|
|
|
} |
54
|
|
|
|