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