1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author @jayS-de <[email protected]> |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace Commercetools\Core\Model\CustomField; |
7
|
|
|
|
8
|
|
|
use Commercetools\Core\Model\Common\Context; |
9
|
|
|
use Commercetools\Core\Model\Common\JsonObject; |
10
|
|
|
use Commercetools\Core\Model\Type\TypeReference; |
11
|
|
|
use Commercetools\Core\Model\Common\ResourceIdentifier; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @package Commercetools\Core\Model\CustomField |
15
|
|
|
* @link https://dev.commercetools.com/http-api-projects-custom-fields.html#customfieldsdraft |
16
|
|
|
* @method FieldContainer getFields() |
17
|
|
|
* @method CustomFieldObjectDraft setFields(FieldContainer $fields = null) |
18
|
|
|
* @method TypeReference getType() |
19
|
|
|
* @method CustomFieldObjectDraft setType(TypeReference $type = null) |
20
|
|
|
*/ |
21
|
|
|
class CustomFieldObjectDraft extends CustomFieldObject |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @param $typeKey |
25
|
|
|
* @param Context|callable $context |
26
|
|
|
* @return CustomFieldObjectDraft |
27
|
|
|
*/ |
28
|
8 |
|
public static function ofTypeKey($typeKey, $context = null) |
29
|
|
|
{ |
30
|
8 |
|
$draft = static::of($context)->setType(TypeReference::ofKey($typeKey)); |
31
|
|
|
|
32
|
8 |
|
return $draft; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @param string $typeId |
37
|
|
|
* @param Context|callable $context |
38
|
|
|
* @return CustomFieldObjectDraft |
39
|
|
|
*/ |
40
|
|
|
public static function ofTypeId($typeId, $context = null) |
41
|
|
|
{ |
42
|
|
|
$draft = static::of($context)->setType(TypeReference::ofId($typeId)); |
43
|
|
|
|
44
|
|
|
return $draft; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @param TypeReference $type |
49
|
|
|
* @param Context|callable $context |
50
|
|
|
* @return CustomFieldObjectDraft |
51
|
|
|
*/ |
52
|
4 |
|
public static function ofType(TypeReference $type, $context = null) |
53
|
|
|
{ |
54
|
4 |
|
$draft = static::of($context)->setType($type); |
55
|
|
|
|
56
|
4 |
|
return $draft; |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|