9
9
*/
10
10
namespace Magento \Store \Model ;
11
11
12
+ use Magento \Framework \App \ObjectManager ;
13
+ use Magento \Framework \MessageQueue \PoisonPill \PoisonPillPutInterface ;
14
+ use Magento \Store \Model \Validation \StoreValidator ;
15
+
12
16
/**
13
- * Class Group
17
+ * Store Group model class used to retrieve and format group information
14
18
*
15
19
* @api
16
20
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -21,9 +25,9 @@ class Group extends \Magento\Framework\Model\AbstractExtensibleModel implements
21
25
\Magento \Store \Api \Data \GroupInterface,
22
26
\Magento \Framework \App \ScopeInterface
23
27
{
24
- const ENTITY = 'store_group ' ;
28
+ public const ENTITY = 'store_group ' ;
25
29
26
- const CACHE_TAG = 'store_group ' ;
30
+ public const CACHE_TAG = 'store_group ' ;
27
31
28
32
/**
29
33
* @var bool
@@ -101,10 +105,15 @@ class Group extends \Magento\Framework\Model\AbstractExtensibleModel implements
101
105
private $ eventManager ;
102
106
103
107
/**
104
- * @var \Magento\Framework\MessageQueue\PoisonPill\ PoisonPillPutInterface
108
+ * @var PoisonPillPutInterface
105
109
*/
106
110
private $ pillPut ;
107
111
112
+ /**
113
+ * @var StoreValidator
114
+ */
115
+ private $ modelValidator ;
116
+
108
117
/**
109
118
* @param \Magento\Framework\Model\Context $context
110
119
* @param \Magento\Framework\Registry $registry
@@ -117,7 +126,8 @@ class Group extends \Magento\Framework\Model\AbstractExtensibleModel implements
117
126
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
118
127
* @param array $data
119
128
* @param \Magento\Framework\Event\ManagerInterface|null $eventManager
120
- * @param \Magento\Framework\MessageQueue\PoisonPill\PoisonPillPutInterface|null $pillPut
129
+ * @param PoisonPillPutInterface|null $pillPut
130
+ * @param StoreValidator|null $modelValidator
121
131
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
122
132
*/
123
133
public function __construct (
@@ -132,15 +142,18 @@ public function __construct(
132
142
\Magento \Framework \Data \Collection \AbstractDb $ resourceCollection = null ,
133
143
array $ data = [],
134
144
\Magento \Framework \Event \ManagerInterface $ eventManager = null ,
135
- \Magento \Framework \MessageQueue \PoisonPill \PoisonPillPutInterface $ pillPut = null
145
+ PoisonPillPutInterface $ pillPut = null ,
146
+ StoreValidator $ modelValidator = null
136
147
) {
137
148
$ this ->_configDataResource = $ configDataResource ;
138
149
$ this ->_storeListFactory = $ storeListFactory ;
139
150
$ this ->_storeManager = $ storeManager ;
140
151
$ this ->eventManager = $ eventManager ?: \Magento \Framework \App \ObjectManager::getInstance ()
141
152
->get (\Magento \Framework \Event \ManagerInterface::class);
142
153
$ this ->pillPut = $ pillPut ?: \Magento \Framework \App \ObjectManager::getInstance ()
143
- ->get (\Magento \Framework \MessageQueue \PoisonPill \PoisonPillPutInterface::class);
154
+ ->get (PoisonPillPutInterface::class);
155
+ $ this ->modelValidator = $ modelValidator ?: ObjectManager::getInstance ()
156
+ ->get (StoreValidator::class);
144
157
parent ::__construct (
145
158
$ context ,
146
159
$ registry ,
@@ -162,6 +175,17 @@ protected function _construct()
162
175
$ this ->_init (\Magento \Store \Model \ResourceModel \Group::class);
163
176
}
164
177
178
+ /**
179
+ * Validation rules for store
180
+ *
181
+ * @return \Zend_Validate_Interface|null
182
+ * @throws \Zend_Validate_Exception
183
+ */
184
+ protected function _getValidationRulesBeforeSave (): ?\Zend_Validate_Interface
185
+ {
186
+ return $ this ->modelValidator ;
187
+ }
188
+
165
189
/**
166
190
* Load store collection and set internal data
167
191
*
0 commit comments