|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* TechDivision\Import\Attribute\Services\AttributeSetBunchProcessor |
|
5
|
|
|
* |
|
6
|
|
|
* PHP version 7 |
|
7
|
|
|
* |
|
8
|
|
|
* @author Tim Wagner <[email protected]> |
|
9
|
|
|
* @copyright 2019 TechDivision GmbH <[email protected]> |
|
10
|
|
|
* @license https://opensource.org/licenses/MIT |
|
11
|
|
|
* @link https://github.com/techdivision/import-attribute-set |
|
12
|
|
|
* @link http://www.techdivision.com |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
namespace TechDivision\Import\Attribute\Set\Services; |
|
16
|
|
|
|
|
17
|
|
|
use TechDivision\Import\Dbal\Actions\ActionInterface; |
|
18
|
|
|
use TechDivision\Import\Loaders\LoaderInterface; |
|
19
|
|
|
use TechDivision\Import\Dbal\Connection\ConnectionInterface; |
|
20
|
|
|
use TechDivision\Import\Repositories\EavAttributeSetRepositoryInterface; |
|
21
|
|
|
use TechDivision\Import\Attribute\Set\Repositories\EntityAttributeRepositoryInterface; |
|
22
|
|
|
use TechDivision\Import\Attribute\Set\Repositories\EavAttributeGroupRepositoryInterface; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* The attribute set bunch processor implementation. |
|
26
|
|
|
* |
|
27
|
|
|
* @author Tim Wagner <[email protected]> |
|
28
|
|
|
* @copyright 2019 TechDivision GmbH <[email protected]> |
|
29
|
|
|
* @license https://opensource.org/licenses/MIT |
|
30
|
|
|
* @link https://github.com/techdivision/import-attribute-set |
|
31
|
|
|
* @link http://www.techdivision.com |
|
32
|
|
|
*/ |
|
33
|
|
|
class AttributeSetBunchProcessor implements AttributeSetBunchProcessorInterface |
|
34
|
|
|
{ |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* A connection to use. |
|
38
|
|
|
* |
|
39
|
|
|
* @var \TechDivision\Import\Dbal\Connection\ConnectionInterface |
|
40
|
|
|
*/ |
|
41
|
|
|
protected $connection; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* The EAV attribute set repository instance. |
|
45
|
|
|
* |
|
46
|
|
|
* @var \TechDivision\Import\Repositories\EavAttributeSetRepositoryInterface |
|
47
|
|
|
*/ |
|
48
|
|
|
protected $eavAttributeSetRepository; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* The EAV attribute set repository instance. |
|
52
|
|
|
* |
|
53
|
|
|
* @var \TechDivision\Import\Attribute\Set\Repositories\EavAttributeGroupRepositoryInterface |
|
54
|
|
|
*/ |
|
55
|
|
|
protected $eavAttributeGroupRepository; |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* The EAV entity attribute repository instance. |
|
59
|
|
|
* |
|
60
|
|
|
* @var \TechDivision\Import\Attribute\Set\Repositories\EntityAttributeRepositoryInterface |
|
61
|
|
|
*/ |
|
62
|
|
|
protected $attributeOptionRepository; |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* The attribute set action instance. |
|
66
|
|
|
* |
|
67
|
|
|
* @var \TechDivision\Import\Dbal\Actions\ActionInterface |
|
68
|
|
|
*/ |
|
69
|
|
|
protected $eavAttributeSetAction; |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* The attribute group action instance. |
|
73
|
|
|
* |
|
74
|
|
|
* @var \TechDivision\Import\Dbal\Actions\ActionInterface |
|
75
|
|
|
*/ |
|
76
|
|
|
protected $eavAttributeGroupAction; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* The entity attribute action instance. |
|
80
|
|
|
* |
|
81
|
|
|
* @var \TechDivision\Import\Dbal\Actions\ActionInterface |
|
82
|
|
|
*/ |
|
83
|
|
|
protected $entityAttributeAction; |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* The raw entity loader instance. |
|
87
|
|
|
* |
|
88
|
|
|
* @var \TechDivision\Import\Loaders\LoaderInterface |
|
89
|
|
|
*/ |
|
90
|
|
|
protected $rawEntityLoader; |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* The EAV attribute option repository instance |
|
94
|
|
|
* |
|
95
|
|
|
* @var \TechDivision\Import\Attribute\Set\Repositories\EntityAttributeRepositoryInterface |
|
96
|
|
|
*/ |
|
97
|
|
|
protected $entityAttributeRepository; |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* Initialize the processor with the necessary repository and action instances. |
|
101
|
|
|
* |
|
102
|
|
|
* @param \TechDivision\Import\Dbal\Connection\ConnectionInterface $connection The connection to use |
|
103
|
|
|
* @param \TechDivision\Import\Repositories\EavAttributeSetRepositoryInterface $eavAttributeSetRepository The EAV attribute set repository instance |
|
104
|
|
|
* @param \TechDivision\Import\Attribute\Set\Repositories\EavAttributeGroupRepositoryInterface $eavAttributeGroupRepository The EAV attribute group repository instance |
|
105
|
|
|
* @param \TechDivision\Import\Attribute\Set\Repositories\EntityAttributeRepositoryInterface $entityAttributeRepository The EAV attribute option repository instance |
|
106
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $eavAttributeSetAction The EAV attribute set action instance |
|
107
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $eavAttributeGroupAction The EAV attribute gropu action instance |
|
108
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $entityAttributeAction The entity attribute action instance |
|
109
|
|
|
* @param \TechDivision\Import\Loaders\LoaderInterface $rawEntityLoader The raw entity loader instance |
|
110
|
|
|
*/ |
|
111
|
|
|
public function __construct( |
|
112
|
|
|
ConnectionInterface $connection, |
|
113
|
|
|
EavAttributeSetRepositoryInterface $eavAttributeSetRepository, |
|
114
|
|
|
EavAttributeGroupRepositoryInterface $eavAttributeGroupRepository, |
|
115
|
|
|
EntityAttributeRepositoryInterface $entityAttributeRepository, |
|
116
|
|
|
ActionInterface $eavAttributeSetAction, |
|
117
|
|
|
ActionInterface $eavAttributeGroupAction, |
|
118
|
|
|
ActionInterface $entityAttributeAction, |
|
119
|
|
|
LoaderInterface $rawEntityLoader |
|
120
|
|
|
) { |
|
121
|
|
|
$this->setConnection($connection); |
|
122
|
|
|
$this->setEavAttributeSetRepository($eavAttributeSetRepository); |
|
123
|
|
|
$this->setEavAttributeGroupRepository($eavAttributeGroupRepository); |
|
124
|
|
|
$this->setEntityAttributeRepository($entityAttributeRepository); |
|
125
|
|
|
$this->setEavAttributeSetAction($eavAttributeSetAction); |
|
126
|
|
|
$this->setEavAttributeGroupAction($eavAttributeGroupAction); |
|
127
|
|
|
$this->setEntityAttributeAction($entityAttributeAction); |
|
128
|
|
|
$this->setRawEntityLoader($rawEntityLoader); |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
/** |
|
132
|
|
|
* Set's the raw entity loader instance. |
|
133
|
|
|
* |
|
134
|
|
|
* @param \TechDivision\Import\Loaders\LoaderInterface $rawEntityLoader The raw entity loader instance to set |
|
135
|
|
|
* |
|
136
|
|
|
* @return void |
|
137
|
|
|
*/ |
|
138
|
|
|
public function setRawEntityLoader(LoaderInterface $rawEntityLoader) |
|
139
|
|
|
{ |
|
140
|
|
|
$this->rawEntityLoader = $rawEntityLoader; |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* Return's the raw entity loader instance. |
|
145
|
|
|
* |
|
146
|
|
|
* @return \TechDivision\Import\Loaders\LoaderInterface The raw entity loader instance |
|
147
|
|
|
*/ |
|
148
|
|
|
public function getRawEntityLoader() |
|
149
|
|
|
{ |
|
150
|
|
|
return $this->rawEntityLoader; |
|
151
|
|
|
} |
|
152
|
|
|
|
|
153
|
|
|
/** |
|
154
|
|
|
* Set's the passed connection. |
|
155
|
|
|
* |
|
156
|
|
|
* @param \TechDivision\Import\Dbal\Connection\ConnectionInterface $connection The connection to set |
|
157
|
|
|
* |
|
158
|
|
|
* @return void |
|
159
|
|
|
*/ |
|
160
|
|
|
public function setConnection(ConnectionInterface $connection) |
|
161
|
|
|
{ |
|
162
|
|
|
$this->connection = $connection; |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* Return's the connection. |
|
167
|
|
|
* |
|
168
|
|
|
* @return \TechDivision\Import\Dbal\Connection\ConnectionInterface The connection instance |
|
169
|
|
|
*/ |
|
170
|
|
|
public function getConnection() |
|
171
|
|
|
{ |
|
172
|
|
|
return $this->connection; |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO |
|
177
|
|
|
* object instance are not committed until you end the transaction by calling ProductProcessor::commit(). |
|
178
|
|
|
* Calling ProductProcessor::rollBack() will roll back all changes to the database and return the connection |
|
179
|
|
|
* to autocommit mode. |
|
180
|
|
|
* |
|
181
|
|
|
* @return boolean Returns TRUE on success or FALSE on failure |
|
182
|
|
|
* @link http://php.net/manual/en/pdo.begintransaction.php |
|
183
|
|
|
*/ |
|
184
|
|
|
public function beginTransaction() |
|
185
|
|
|
{ |
|
186
|
|
|
return $this->connection->beginTransaction(); |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
/** |
|
190
|
|
|
* Commits a transaction, returning the database connection to autocommit mode until the next call to |
|
191
|
|
|
* ProductProcessor::beginTransaction() starts a new transaction. |
|
192
|
|
|
* |
|
193
|
|
|
* @return boolean Returns TRUE on success or FALSE on failure |
|
194
|
|
|
* @link http://php.net/manual/en/pdo.commit.php |
|
195
|
|
|
*/ |
|
196
|
|
|
public function commit() |
|
197
|
|
|
{ |
|
198
|
|
|
return $this->connection->commit(); |
|
|
|
|
|
|
199
|
|
|
} |
|
200
|
|
|
|
|
201
|
|
|
/** |
|
202
|
|
|
* Rolls back the current transaction, as initiated by ProductProcessor::beginTransaction(). |
|
203
|
|
|
* |
|
204
|
|
|
* If the database was set to autocommit mode, this function will restore autocommit mode after it has |
|
205
|
|
|
* rolled back the transaction. |
|
206
|
|
|
* |
|
207
|
|
|
* Some databases, including MySQL, automatically issue an implicit COMMIT when a database definition |
|
208
|
|
|
* language (DDL) statement such as DROP TABLE or CREATE TABLE is issued within a transaction. The implicit |
|
209
|
|
|
* COMMIT will prevent you from rolling back any other changes within the transaction boundary. |
|
210
|
|
|
* |
|
211
|
|
|
* @return boolean Returns TRUE on success or FALSE on failure |
|
212
|
|
|
* @link http://php.net/manual/en/pdo.rollback.php |
|
213
|
|
|
*/ |
|
214
|
|
|
public function rollBack() |
|
215
|
|
|
{ |
|
216
|
|
|
return $this->connection->rollBack(); |
|
217
|
|
|
} |
|
218
|
|
|
|
|
219
|
|
|
/** |
|
220
|
|
|
* Set's the attribute set repository instance. |
|
221
|
|
|
* |
|
222
|
|
|
* @param \TechDivision\Import\Repositories\EavAttributeSetRepositoryInterface $eavAttributeSetRepository The attribute set repository instance |
|
223
|
|
|
* |
|
224
|
|
|
* @return void |
|
225
|
|
|
*/ |
|
226
|
|
|
public function setEavAttributeSetRepository(EavAttributeSetRepositoryInterface $eavAttributeSetRepository) |
|
227
|
|
|
{ |
|
228
|
|
|
$this->eavAttributeSetRepository = $eavAttributeSetRepository; |
|
229
|
|
|
} |
|
230
|
|
|
|
|
231
|
|
|
/** |
|
232
|
|
|
* Return's the attribute set repository instance. |
|
233
|
|
|
* |
|
234
|
|
|
* @return \TechDivision\Import\Repositories\EavAttributeSetRepositoryInterface The attribute set repository instance |
|
235
|
|
|
*/ |
|
236
|
|
|
public function getEavAttributeSetRepository() |
|
237
|
|
|
{ |
|
238
|
|
|
return $this->eavAttributeSetRepository; |
|
239
|
|
|
} |
|
240
|
|
|
|
|
241
|
|
|
/** |
|
242
|
|
|
* Set's the attribute group repository instance. |
|
243
|
|
|
* |
|
244
|
|
|
* @param \TechDivision\Import\Attribute\Set\Repositories\EavAttributeGroupRepositoryInterface $eavAttributeGroupRepository The attribute group repository instance |
|
245
|
|
|
* |
|
246
|
|
|
* @return void |
|
247
|
|
|
*/ |
|
248
|
|
|
public function setEavAttributeGroupRepository(EavAttributeGroupRepositoryInterface $eavAttributeGroupRepository) |
|
249
|
|
|
{ |
|
250
|
|
|
$this->eavAttributeGroupRepository = $eavAttributeGroupRepository; |
|
251
|
|
|
} |
|
252
|
|
|
|
|
253
|
|
|
/** |
|
254
|
|
|
* Return's the attribute group repository instance. |
|
255
|
|
|
* |
|
256
|
|
|
* @return \TechDivision\Import\Attribute\Set\Repositories\EavAttributeGroupRepositoryInterface The attribute group repository instance |
|
257
|
|
|
*/ |
|
258
|
|
|
public function getEavAttributeGroupRepository() |
|
259
|
|
|
{ |
|
260
|
|
|
return $this->eavAttributeGroupRepository; |
|
261
|
|
|
} |
|
262
|
|
|
|
|
263
|
|
|
/** |
|
264
|
|
|
* Set's the entity attribute repository instance. |
|
265
|
|
|
* |
|
266
|
|
|
* @param \TechDivision\Import\Attribute\Set\Repositories\EntityAttributeRepositoryInterface $entityAttributeRepository The entity attribute repository instance |
|
267
|
|
|
* |
|
268
|
|
|
* @return void |
|
269
|
|
|
*/ |
|
270
|
|
|
public function setEntityAttributeRepository(EntityAttributeRepositoryInterface $entityAttributeRepository) |
|
271
|
|
|
{ |
|
272
|
|
|
$this->entityAttributeRepository = $entityAttributeRepository; |
|
273
|
|
|
} |
|
274
|
|
|
|
|
275
|
|
|
/** |
|
276
|
|
|
* Return's the entity attribute repository instance. |
|
277
|
|
|
* |
|
278
|
|
|
* @return \TechDivision\Import\Attribute\Set\Repositories\EntityAttributeRepositoryInterface The entity attribute repository instance |
|
279
|
|
|
*/ |
|
280
|
|
|
public function getEntityAttributeRepository() |
|
281
|
|
|
{ |
|
282
|
|
|
return $this->entityAttributeRepository; |
|
283
|
|
|
} |
|
284
|
|
|
|
|
285
|
|
|
/** |
|
286
|
|
|
* Set's the EAV attribute set action instance. |
|
287
|
|
|
* |
|
288
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $eavAttributeSetAction The attribute set action instance |
|
289
|
|
|
* |
|
290
|
|
|
* @return void |
|
291
|
|
|
*/ |
|
292
|
|
|
public function setEavAttributeSetAction(ActionInterface $eavAttributeSetAction) |
|
293
|
|
|
{ |
|
294
|
|
|
$this->eavAttributeSetAction = $eavAttributeSetAction; |
|
295
|
|
|
} |
|
296
|
|
|
|
|
297
|
|
|
/** |
|
298
|
|
|
* Return's the attribute set action instance. |
|
299
|
|
|
* |
|
300
|
|
|
* @return \TechDivision\Import\Dbal\Actions\ActionInterface The attribute set action instance |
|
301
|
|
|
*/ |
|
302
|
|
|
public function getEavAttributeSetAction() |
|
303
|
|
|
{ |
|
304
|
|
|
return $this->eavAttributeSetAction; |
|
305
|
|
|
} |
|
306
|
|
|
|
|
307
|
|
|
/** |
|
308
|
|
|
* Set's the EAV attribute group action instance. |
|
309
|
|
|
* |
|
310
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $eavAttributeGroupAction The attribute gropu action instance |
|
311
|
|
|
* |
|
312
|
|
|
* @return void |
|
313
|
|
|
*/ |
|
314
|
|
|
public function setEavAttributeGroupAction(ActionInterface $eavAttributeGroupAction) |
|
315
|
|
|
{ |
|
316
|
|
|
$this->eavAttributeGroupAction = $eavAttributeGroupAction; |
|
317
|
|
|
} |
|
318
|
|
|
|
|
319
|
|
|
/** |
|
320
|
|
|
* Return's the attribute group action instance. |
|
321
|
|
|
* |
|
322
|
|
|
* @return \TechDivision\Import\Dbal\Actions\ActionInterface The attribute group action instance |
|
323
|
|
|
*/ |
|
324
|
|
|
public function getEavAttributeGroupAction() |
|
325
|
|
|
{ |
|
326
|
|
|
return $this->eavAttributeGroupAction; |
|
327
|
|
|
} |
|
328
|
|
|
|
|
329
|
|
|
/** |
|
330
|
|
|
* Set's the entity attribute action instance. |
|
331
|
|
|
* |
|
332
|
|
|
* @param \TechDivision\Import\Dbal\Actions\ActionInterface $entityAttributeAction The entity attribute action instance |
|
333
|
|
|
* |
|
334
|
|
|
* @return void |
|
335
|
|
|
*/ |
|
336
|
|
|
public function setEntityAttributeAction(ActionInterface $entityAttributeAction) |
|
337
|
|
|
{ |
|
338
|
|
|
$this->entityAttributeAction = $entityAttributeAction; |
|
339
|
|
|
} |
|
340
|
|
|
|
|
341
|
|
|
/** |
|
342
|
|
|
* Return's the entity attribute action instance. |
|
343
|
|
|
* |
|
344
|
|
|
* @return \TechDivision\Import\Dbal\Actions\ActionInterface The entity attribute action instance |
|
345
|
|
|
*/ |
|
346
|
|
|
public function getEntityAttributeAction() |
|
347
|
|
|
{ |
|
348
|
|
|
return $this->entityAttributeAction; |
|
349
|
|
|
} |
|
350
|
|
|
|
|
351
|
|
|
/** |
|
352
|
|
|
* Load's and return's a raw entity without primary key but the mandatory members only and nulled values. |
|
353
|
|
|
* |
|
354
|
|
|
* @param string $entityTypeCode The entity type code to return the raw entity for |
|
355
|
|
|
* @param array $data An array with data that will be used to initialize the raw entity with |
|
356
|
|
|
* |
|
357
|
|
|
* @return array The initialized entity |
|
358
|
|
|
*/ |
|
359
|
|
|
public function loadRawEntity($entityTypeCode, array $data = array()) |
|
360
|
|
|
{ |
|
361
|
|
|
return $this->getRawEntityLoader()->load($entityTypeCode, $data); |
|
|
|
|
|
|
362
|
|
|
} |
|
363
|
|
|
|
|
364
|
|
|
/** |
|
365
|
|
|
* Load's and return's the EAV attribute set with the passed entity type code and attribute set name. |
|
366
|
|
|
* |
|
367
|
|
|
* @param string $entityTypeCode The entity type code of the EAV attribute set to load |
|
368
|
|
|
* @param string $attributeSetName The attribute set name of the EAV attribute set to return |
|
369
|
|
|
* |
|
370
|
|
|
* @return array The EAV attribute set |
|
371
|
|
|
*/ |
|
372
|
|
|
public function loadAttributeSetByEntityTypeCodeAndAttributeSetName($entityTypeCode, $attributeSetName) |
|
373
|
|
|
{ |
|
374
|
|
|
return $this->getEavAttributeSetRepository()->findOneByEntityTypeCodeAndAttributeSetName($entityTypeCode, $attributeSetName); |
|
375
|
|
|
} |
|
376
|
|
|
|
|
377
|
|
|
/** |
|
378
|
|
|
* Load's and return's the EAV attribute set with the passed entity type ID and attribute set name. |
|
379
|
|
|
* |
|
380
|
|
|
* @param string $entityTypeId The entity type ID of the EAV attribute set to load |
|
381
|
|
|
* @param string $attributeSetName The attribute set name of the EAV attribute set to return |
|
382
|
|
|
* |
|
383
|
|
|
* @return array The EAV attribute set |
|
384
|
|
|
*/ |
|
385
|
|
|
public function loadAttributeSetByEntityTypeIdAndAttributeSetName($entityTypeId, $attributeSetName) |
|
386
|
|
|
{ |
|
387
|
|
|
return $this->getEavAttributeSetRepository()->findOneByEntityTypeIdAndAttributeSetName($entityTypeId, $attributeSetName); |
|
388
|
|
|
} |
|
389
|
|
|
|
|
390
|
|
|
/** |
|
391
|
|
|
* Return's the EAV attribute group with the passed entity type code, attribute set and attribute group name. |
|
392
|
|
|
* |
|
393
|
|
|
* @param string $entityTypeCode The entity type code of the EAV attribute group to return |
|
394
|
|
|
* @param string $attributeSetName The attribute set name of the EAV attribute group to return |
|
395
|
|
|
* @param string $attributeGroupName The attribute group name of the EAV attribute group to return |
|
396
|
|
|
* |
|
397
|
|
|
* @return array The EAV attribute group |
|
398
|
|
|
*/ |
|
399
|
|
|
public function loadAttributeGroupByEntityTypeCodeAndAttributeSetNameAndAttributeGroupName($entityTypeCode, $attributeSetName, $attributeGroupName) |
|
400
|
|
|
{ |
|
401
|
|
|
return $this->getEavAttributeGroupRepository()->findOneByEntityTypeCodeAndAttributeSetNameAndAttributeGroupName($entityTypeCode, $attributeSetName, $attributeGroupName); |
|
402
|
|
|
} |
|
403
|
|
|
|
|
404
|
|
|
/** |
|
405
|
|
|
* Returns the EAV entity attributes for the attribute group with the passed ID. |
|
406
|
|
|
* |
|
407
|
|
|
* @param integer $attributeGroupId The attribute group ID to load the EAV entity attributes for |
|
408
|
|
|
* |
|
409
|
|
|
* @return array|null The EAV attributes with for the passed attribute group ID |
|
410
|
|
|
*/ |
|
411
|
|
|
public function loadEntityAttributesByAttributeGroupId($attributeGroupId) |
|
412
|
|
|
{ |
|
413
|
|
|
return $this->getEntityAttributeRepository()->findAllByAttributeGroupId($attributeGroupId); |
|
414
|
|
|
} |
|
415
|
|
|
|
|
416
|
|
|
/** |
|
417
|
|
|
* Returns the EAV entity attributes for the entity type ID and attribute set with the passed name. |
|
418
|
|
|
* |
|
419
|
|
|
* @param integer $entityTypeId The entity type ID to load the EAV entity attributes for |
|
420
|
|
|
* @param string $attributeSetName The attribute set name to return the EAV entity attributes for |
|
421
|
|
|
* |
|
422
|
|
|
* @return array|null The EAV entity attributes with for the passed entity type ID and attribute set name |
|
423
|
|
|
*/ |
|
424
|
|
|
public function loadEntityAttributesByEntityTypeIdAndAttributeSetName($entityTypeId, $attributeSetName) |
|
425
|
|
|
{ |
|
426
|
|
|
return $this->getEntityAttributeRepository()->findAllByEntityTypeIdAndAttributeSetName($entityTypeId, $attributeSetName); |
|
427
|
|
|
} |
|
428
|
|
|
|
|
429
|
|
|
/** |
|
430
|
|
|
* Return's the EAV entity attribute with the passed attribute and attribute set ID. |
|
431
|
|
|
* |
|
432
|
|
|
* @param integer $attributeId The ID of the EAV entity attribute's attribute to return |
|
433
|
|
|
* @param integer $attributeSetId The ID of the EAV entity attribute's attribute set to return |
|
434
|
|
|
* |
|
435
|
|
|
* @return array The EAV entity attribute |
|
436
|
|
|
*/ |
|
437
|
|
|
public function loadEntityAttributeByAttributeIdAndAttributeSetId($attributeId, $attributeSetId) |
|
438
|
|
|
{ |
|
439
|
|
|
return $this->getEntityAttributeRepository()->findOneByAttributeIdAndAttributeSetId($attributeId, $attributeSetId); |
|
440
|
|
|
} |
|
441
|
|
|
|
|
442
|
|
|
/** |
|
443
|
|
|
* Return's the attribute groups for the passed attribute set ID, whereas the array |
|
444
|
|
|
* is prepared with the attribute group names as keys. |
|
445
|
|
|
* |
|
446
|
|
|
* @param mixed $attributeSetId The EAV attribute set ID to return the attribute groups for |
|
447
|
|
|
* |
|
448
|
|
|
* @return array|boolean The EAV attribute groups for the passed attribute ID |
|
449
|
|
|
*/ |
|
450
|
|
|
public function loadAttributeGroupsByAttributeSetId($attributeSetId) |
|
451
|
|
|
{ |
|
452
|
|
|
return $this->getEavAttributeGroupRepository()->findAllByAttributeSetId($attributeSetId); |
|
453
|
|
|
} |
|
454
|
|
|
|
|
455
|
|
|
/** |
|
456
|
|
|
* Return's the attribute group for the passed attribute set ID and attribute group code. |
|
457
|
|
|
* |
|
458
|
|
|
* @param integer $attributeSetId The EAV attribute set ID to return the attribute group for |
|
459
|
|
|
* @param string $attributeGroupCode The EAV attribute group code to load the attribute group for |
|
460
|
|
|
* |
|
461
|
|
|
* @return array|boolean The EAV attribute group for the passed attribute set ID and attribute group code |
|
462
|
|
|
*/ |
|
463
|
|
|
public function loadAttributeGroupByAttributeSetIdAndAttributeGroupCode($attributeSetId, $attributeGroupCode) |
|
464
|
|
|
{ |
|
465
|
|
|
return $this->getEavAttributeGroupRepository()->findOneByAttributeSetIdAndAttributeGroupCode($attributeSetId, $attributeGroupCode); |
|
466
|
|
|
} |
|
467
|
|
|
|
|
468
|
|
|
/** |
|
469
|
|
|
* Persist's the passed EAV attribute set data and return's the ID. |
|
470
|
|
|
* |
|
471
|
|
|
* @param array $attributeSet The attribute set data to persist |
|
472
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
|
473
|
|
|
* |
|
474
|
|
|
* @return string The ID of the persisted attribute set |
|
475
|
|
|
*/ |
|
476
|
|
|
public function persistAttributeSet(array $attributeSet, $name = null) |
|
477
|
|
|
{ |
|
478
|
|
|
return $this->getEavAttributeSetAction()->persist($attributeSet); |
|
|
|
|
|
|
479
|
|
|
} |
|
480
|
|
|
|
|
481
|
|
|
/** |
|
482
|
|
|
* Persist the passed EAV attribute group. |
|
483
|
|
|
* |
|
484
|
|
|
* @param array $attributeGroup The attribute group to persist |
|
485
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
|
486
|
|
|
* |
|
487
|
|
|
* @return string The ID of the persisted attribute group |
|
488
|
|
|
*/ |
|
489
|
|
|
public function persistAttributeGroup(array $attributeGroup, $name = null) |
|
490
|
|
|
{ |
|
491
|
|
|
return $this->getEavAttributeGroupAction()->persist($attributeGroup); |
|
|
|
|
|
|
492
|
|
|
} |
|
493
|
|
|
|
|
494
|
|
|
/** |
|
495
|
|
|
* Persist's the passed EAV entity attribute data and return's the ID. |
|
496
|
|
|
* |
|
497
|
|
|
* @param array $entityAttribute The entity attribute data to persist |
|
498
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
|
499
|
|
|
* |
|
500
|
|
|
* @return void |
|
501
|
|
|
*/ |
|
502
|
|
|
public function persistEntityAttribute(array $entityAttribute, $name = null) |
|
503
|
|
|
{ |
|
504
|
|
|
$this->getEntityAttributeAction()->persist($entityAttribute, $name); |
|
|
|
|
|
|
505
|
|
|
} |
|
506
|
|
|
|
|
507
|
|
|
/** |
|
508
|
|
|
* Delete's the EAV attribute set with the passed attributes. |
|
509
|
|
|
* |
|
510
|
|
|
* @param array $row The attributes of the EAV attribute group to delete |
|
511
|
|
|
* @param string|null $name The name of the prepared statement that has to be executed |
|
512
|
|
|
* |
|
513
|
|
|
* @return void |
|
514
|
|
|
*/ |
|
515
|
|
|
public function deleteAttributeSet($row, $name = null) |
|
516
|
|
|
{ |
|
517
|
|
|
$this->getEavAttributeSetAction()->delete($row, $name); |
|
|
|
|
|
|
518
|
|
|
} |
|
519
|
|
|
} |
|
520
|
|
|
|