-
Notifications
You must be signed in to change notification settings - Fork 9.4k
/
Copy pathOption.php
127 lines (115 loc) · 2.66 KB
/
Option.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Eav\Model\Entity\Attribute;
use Magento\Eav\Api\Data\AttributeOptionInterface;
use Magento\Framework\Model\AbstractModel;
/**
* Entity attribute option model
*
* @method int getAttributeId()
* @method \Magento\Eav\Model\Entity\Attribute\Option setAttributeId(int $value)
*
* @api
* @codeCoverageIgnore
* @since 100.0.2
*/
class Option extends AbstractModel implements AttributeOptionInterface
{
/**
* Resource initialization
*
* @return void
*/
public function _construct()
{
$this->_init(\Magento\Eav\Model\ResourceModel\Entity\Attribute\Option::class);
}
/**
* {@inheritdoc}
*/
public function getLabel()
{
return $this->getData(AttributeOptionInterface::LABEL);
}
/**
* {@inheritdoc}
*/
public function getValue()
{
return $this->getData(AttributeOptionInterface::VALUE);
}
/**
* {@inheritdoc}
*/
public function getSortOrder()
{
return $this->getData(AttributeOptionInterface::SORT_ORDER);
}
/**
* {@inheritdoc}
*/
public function getIsDefault()
{
return $this->getData(AttributeOptionInterface::IS_DEFAULT);
}
/**
* {@inheritdoc}
*/
public function getStoreLabels()
{
return $this->getData(AttributeOptionInterface::STORE_LABELS);
}
/**
* Set option label
*
* @param string $label
* @return $this
*/
public function setLabel($label)
{
return $this->setData(AttributeOptionInterface::LABEL, $label);
}
/**
* Set option value
*
* @param string $value
* @return string
*/
public function setValue($value)
{
return $this->setData(AttributeOptionInterface::VALUE, $value);
}
/**
* Set option order
*
* @param int $sortOrder
* @return $this
*/
public function setSortOrder($sortOrder)
{
return $this->setData(AttributeOptionInterface::SORT_ORDER, $sortOrder);
}
/**
* set is default
*
* @param bool $isDefault
* @return $this
*/
public function setIsDefault($isDefault)
{
return $this->setData(AttributeOptionInterface::IS_DEFAULT, $isDefault);
}
/**
* Set option label for store scopes
*
* @param \Magento\Eav\Api\Data\AttributeOptionLabelInterface[] $storeLabels
* @return $this
*/
public function setStoreLabels(?array $storeLabels = null)
{
return $this->setData(AttributeOptionInterface::STORE_LABELS, $storeLabels);
}
}