|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @author @jayS-de <[email protected]> |
|
4
|
|
|
*/ |
|
5
|
|
|
|
|
6
|
|
|
namespace Commercetools\Core\Model\Review; |
|
7
|
|
|
|
|
8
|
|
|
use Commercetools\Core\Model\Common\Context; |
|
9
|
|
|
use Commercetools\Core\Model\Common\JsonObject; |
|
10
|
|
|
use Commercetools\Core\Model\State\StateReference; |
|
11
|
|
|
use Commercetools\Core\Model\Common\ResourceIdentifier; |
|
12
|
|
|
use Commercetools\Core\Model\Customer\CustomerReference; |
|
13
|
|
|
use Commercetools\Core\Model\CustomField\CustomFieldObject; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* @package Commercetools\Core\Model\Review |
|
17
|
|
|
* |
|
18
|
|
|
* @method string getKey() |
|
19
|
|
|
* @method ReviewDraft setKey(string $key = null) |
|
20
|
|
|
* @method string getUniquenessValue() |
|
21
|
|
|
* @method ReviewDraft setUniquenessValue(string $uniquenessValue = null) |
|
22
|
|
|
* @method string getLocale() |
|
23
|
|
|
* @method ReviewDraft setLocale(string $locale = null) |
|
24
|
|
|
* @method string getAuthorName() |
|
25
|
|
|
* @method ReviewDraft setAuthorName(string $authorName = null) |
|
26
|
|
|
* @method string getTitle() |
|
27
|
|
|
* @method ReviewDraft setTitle(string $title = null) |
|
28
|
|
|
* @method string getText() |
|
29
|
|
|
* @method ReviewDraft setText(string $text = null) |
|
30
|
|
|
* @method ResourceIdentifier getTarget() |
|
31
|
|
|
* @method ReviewDraft setTarget(ResourceIdentifier $target = null) |
|
32
|
|
|
* @method StateReference getState() |
|
33
|
|
|
* @method ReviewDraft setState(StateReference $state = null) |
|
34
|
|
|
* @method int getRating() |
|
35
|
|
|
* @method ReviewDraft setRating(int $rating = null) |
|
36
|
|
|
* @method CustomerReference getCustomer() |
|
37
|
|
|
* @method ReviewDraft setCustomer(CustomerReference $customer = null) |
|
38
|
|
|
* @method CustomFieldObject getCustom() |
|
39
|
|
|
* @method ReviewDraft setCustom(CustomFieldObject $custom = null) |
|
40
|
|
|
*/ |
|
41
|
|
|
class ReviewDraft extends JsonObject |
|
42
|
|
|
{ |
|
43
|
|
|
public function fieldDefinitions() |
|
44
|
|
|
{ |
|
45
|
|
|
return [ |
|
46
|
|
|
'key' => [static::TYPE => 'string'], |
|
47
|
|
|
'uniquenessValue' => [static::TYPE => 'string'], |
|
48
|
|
|
'locale' => [static::TYPE => 'string'], |
|
49
|
|
|
'authorName' => [static::TYPE => 'string'], |
|
50
|
|
|
'title' => [static::TYPE => 'string'], |
|
51
|
|
|
'text' => [static::TYPE => 'string'], |
|
52
|
|
|
'target' => [static::TYPE => '\Commercetools\Core\Model\Common\ResourceIdentifier'], |
|
53
|
|
|
'state' => [static::TYPE => '\Commercetools\Core\Model\State\StateReference'], |
|
54
|
|
|
'rating' => [static::TYPE => 'int'], |
|
55
|
|
|
'customer' => [static::TYPE => '\Commercetools\Core\Model\Customer\CustomerReference'], |
|
56
|
|
|
'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObject'], |
|
57
|
|
|
]; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @param string $title |
|
62
|
|
|
* @param Context|callable $context |
|
63
|
|
|
* @return ReviewDraft |
|
64
|
|
|
*/ |
|
65
|
|
|
public static function ofTitle($title, $context = null) |
|
66
|
|
|
{ |
|
67
|
|
|
return static::of($context)->setTitle($title); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @param string $text |
|
72
|
|
|
* @param Context|callable $context |
|
73
|
|
|
* @return ReviewDraft |
|
74
|
|
|
*/ |
|
75
|
|
|
public static function ofText($text, $context = null) |
|
76
|
|
|
{ |
|
77
|
|
|
return static::of($context)->setText($text); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @param int $rating |
|
82
|
|
|
* @param Context|callable $context |
|
83
|
|
|
* @return ReviewDraft |
|
84
|
|
|
*/ |
|
85
|
|
|
public static function ofRating($rating, $context = null) |
|
86
|
|
|
{ |
|
87
|
|
|
return static::of($context)->setRating($rating); |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
|