1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author @jayS-de <[email protected]> |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace Commercetools\Core\Model\CartDiscount; |
7
|
|
|
|
8
|
|
|
use Commercetools\Core\Model\Channel\ChannelReference; |
9
|
|
|
use Commercetools\Core\Model\Common\Context; |
10
|
|
|
use Commercetools\Core\Model\Product\ProductReference; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @package Commercetools\Core\Model\CartDiscount |
14
|
|
|
* |
15
|
|
|
* @method string getType() |
16
|
|
|
* @method GiftLineItemCartDiscountValue setType(string $type = null) |
17
|
|
|
* @method ProductReference getProduct() |
18
|
|
|
* @method GiftLineItemCartDiscountValue setProduct(ProductReference $product = null) |
19
|
|
|
* @method int getVariantId() |
20
|
|
|
* @method GiftLineItemCartDiscountValue setVariantId(int $variantId = null) |
21
|
|
|
* @method ChannelReference getSupplyChannel() |
22
|
|
|
* @method GiftLineItemCartDiscountValue setSupplyChannel(ChannelReference $supplyChannel = null) |
23
|
|
|
* @method ChannelReference getDistributionChannel() |
24
|
|
|
* @method GiftLineItemCartDiscountValue setDistributionChannel(ChannelReference $distributionChannel = null) |
25
|
|
|
*/ |
26
|
|
|
class GiftLineItemCartDiscountValue extends CartDiscountValue |
|
|
|
|
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* @inheritDoc |
30
|
|
|
*/ |
31
|
1 |
|
public function __construct(array $data = [], $context = null) |
32
|
|
|
{ |
33
|
1 |
|
$data['type'] = static::TYPE_GIFT_LINE_ITEM; |
34
|
|
|
|
35
|
1 |
|
parent::__construct($data, $context); |
36
|
1 |
|
} |
37
|
|
|
|
38
|
1 |
|
public function fieldDefinitions() |
39
|
|
|
{ |
40
|
|
|
return [ |
41
|
1 |
|
'type' => [static::TYPE => 'string'], |
42
|
1 |
|
'product' => [static::TYPE => ProductReference::class], |
43
|
1 |
|
'variantId' => [static::TYPE => 'int'], |
44
|
1 |
|
'supplyChannel' => [static::TYPE => ChannelReference::class], |
45
|
1 |
|
'distributionChannel' => [static::TYPE => ChannelReference::class], |
46
|
|
|
]; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param ProductReference $product |
51
|
|
|
* @param int $variantId |
52
|
|
|
* @param Context|callable $context |
53
|
|
|
* @return GiftLineItemCartDiscountValue |
54
|
|
|
*/ |
55
|
|
|
public static function ofProductAndVariantId(ProductReference $product, $variantId, $context = null) |
56
|
|
|
{ |
57
|
|
|
return static::of($context)->setProduct($product)->setVariantId($variantId); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.