Completed
Pull Request — master (#41)
by Tim
03:27
created

BunchSubject::setAttributeSet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
/**
4
 * TechDivision\Import\Product\Subjects\BunchSubject
5
 *
6
 * NOTICE OF LICENSE
7
 *
8
 * This source file is subject to the Open Software License (OSL 3.0)
9
 * that is available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * PHP version 5
13
 *
14
 * @author    Tim Wagner <[email protected]>
15
 * @copyright 2016 TechDivision GmbH <[email protected]>
16
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
17
 * @link      https://github.com/techdivision/import-product
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Product\Subjects;
22
23
use TechDivision\Import\Product\Utils\MemberNames;
24
use TechDivision\Import\Product\Utils\VisibilityKeys;
25
use TechDivision\Import\Subjects\ExportableTrait;
26
use TechDivision\Import\Subjects\ExportableSubjectInterface;
27
28
/**
29
 * The subject implementation that handles the business logic to persist products.
30
 *
31
 * @author    Tim Wagner <[email protected]>
32
 * @copyright 2016 TechDivision GmbH <[email protected]>
33
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
34
 * @link      https://github.com/techdivision/import-product
35
 * @link      http://www.techdivision.com
36
 */
37
class BunchSubject extends AbstractProductSubject implements ExportableSubjectInterface
38
{
39
40
    /**
41
     * The trait that implements the export functionality.
42
     *
43
     * @var \TechDivision\Import\Subjects\ExportableTrait
44
     */
45
    use ExportableTrait;
46
47
    /**
48
     * The mapping for the supported backend types (for the product entity) => persist methods.
49
     *
50
     * @var array
51
     */
52
    protected $backendTypes = array(
53
        'datetime' => array('persistProductDatetimeAttribute', 'loadProductDatetimeAttribute'),
54
        'decimal'  => array('persistProductDecimalAttribute', 'loadProductDecimalAttribute'),
55
        'int'      => array('persistProductIntAttribute', 'loadProductIntAttribute'),
56
        'text'     => array('persistProductTextAttribute', 'loadProductTextAttribute'),
57
        'varchar'  => array('persistProductVarcharAttribute', 'loadProductVarcharAttribute')
58
    );
59
60
    /**
61
     * Mappings for the table column => CSV column header.
62
     *
63
     * @var array
64
     */
65
    protected $headerStockMappings = array(
66
        'qty'                         => array('qty', 'float'),
67
        'min_qty'                     => array('out_of_stock_qty', 'float'),
68
        'use_config_min_qty'          => array('use_config_min_qty', 'int'),
69
        'is_qty_decimal'              => array('is_qty_decimal', 'int'),
70
        'backorders'                  => array('allow_backorders', 'int'),
71
        'use_config_backorders'       => array('use_config_backorders', 'int'),
72
        'min_sale_qty'                => array('min_cart_qty', 'float'),
73
        'use_config_min_sale_qty'     => array('use_config_min_sale_qty', 'int'),
74
        'max_sale_qty'                => array('max_cart_qty', 'float'),
75
        'use_config_max_sale_qty'     => array('use_config_max_sale_qty', 'int'),
76
        'is_in_stock'                 => array('is_in_stock', 'int'),
77
        'notify_stock_qty'            => array('notify_on_stock_below', 'float'),
78
        'use_config_notify_stock_qty' => array('use_config_notify_stock_qty', 'int'),
79
        'manage_stock'                => array('manage_stock', 'int'),
80
        'use_config_manage_stock'     => array('use_config_manage_stock', 'int'),
81
        'use_config_qty_increments'   => array('use_config_qty_increments', 'int'),
82
        'qty_increments'              => array('qty_increments', 'float'),
83
        'use_config_enable_qty_inc'   => array('use_config_enable_qty_inc', 'int'),
84
        'enable_qty_increments'       => array('enable_qty_increments', 'int'),
85
        'is_decimal_divided'          => array('is_decimal_divided', 'int'),
86
    );
87
88
    /**
89
     * The array with the available visibility keys.
90
     *
91
     * @var array
92
     */
93
    protected $availableVisibilities = array(
94
        'Not Visible Individually' => VisibilityKeys::VISIBILITY_NOT_VISIBLE,
95
        'Catalog'                  => VisibilityKeys::VISIBILITY_IN_CATALOG,
96
        'Search'                   => VisibilityKeys::VISIBILITY_IN_SEARCH,
97
        'Catalog, Search'          => VisibilityKeys::VISIBILITY_BOTH
98
    );
99
100
    /**
101
     * The attribute set of the product that has to be created.
102
     *
103
     * @var array
104
     */
105
    protected $attributeSet = array();
106
107
    /**
108
     * The category IDs the product is related with.
109
     *
110
     * @var array
111
     */
112
    protected $productCategoryIds = array();
113
114
    /**
115
     * The default mappings for the user defined attributes, based on the attributes frontend input type.
116
     *
117
     * @var array
118
     */
119
    protected $defaultFrontendInputCallbackMapping = array(
120
        'select' => 'TechDivision\\Import\\Product\\Callbacks\\SelectCallback',
121
        'multiselect' => 'TechDivision\\Import\\Product\\Callbacks\\MultiselectCallback',
122
        'boolean' => 'TechDivision\\Import\\Product\\Callbacks\\BooleanCallback'
123
    );
124
125
    /**
126
     * The default callback mappings for the Magento standard product attributes.
127
     *
128
     * @var array
129
     */
130
    protected $defaultCallbackMappings = array(
131
        'visibility'           => array('TechDivision\\Import\\Product\\Callbacks\\VisibilityCallback'),
132
        'tax_class_id'         => array('TechDivision\\Import\\Product\\Callbacks\\TaxClassCallback'),
133
        'bundle_price_type'    => array('TechDivision\\Import\\Product\\Bundle\\Callbacks\\BundleTypeCallback'),
134
        'bundle_sku_type'      => array('TechDivision\\Import\\Product\\Bundle\\Callbacks\\BundleTypeCallback'),
135
        'bundle_weight_type'   => array('TechDivision\\Import\\Product\\Bundle\\Callbacks\\BundleTypeCallback'),
136
        'bundle_price_view'    => array('TechDivision\\Import\\Product\\Bundle\\Callbacks\\BundlePriceViewCallback'),
137
        'bundle_shipment_type' => array('TechDivision\\Import\\Product\\Bundle\\Callbacks\\BundleShipmentTypeCallback')
138
    );
139
140
    /**
141
     * Intializes the previously loaded global data for exactly one bunch.
142
     *
143
     * @return void
144
     * @see \Importer\Csv\Actions\ProductImportAction::prepare()
145
     */
146
    public function setUp()
147
    {
148
149
        // initialize the callback mappings with the default mappings
150
        $this->callbackMappings = array_merge($this->callbackMappings, $this->defaultCallbackMappings);
0 ignored issues
show
Bug introduced by
The property callbackMappings does not seem to exist. Did you mean defaultCallbackMappings?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
151
152
        // load the user defined attributes and add the callback mappings
153
        foreach ($this->getEavAttributeByIsUserDefined() as $eavAttribute) {
154
            // load attribute code and frontend input type
155
            $attributeCode = $eavAttribute[MemberNames::ATTRIBUTE_CODE];
156
            $frontendInput = $eavAttribute[MemberNames::FRONTEND_INPUT];
157
158
            // query whether or not the array for the mappings has been initialized
159
            if (!isset($this->callbackMappings[$attributeCode])) {
0 ignored issues
show
Bug introduced by
The property callbackMappings does not seem to exist. Did you mean defaultCallbackMappings?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
160
                $this->callbackMappings[$attributeCode] = array();
0 ignored issues
show
Bug introduced by
The property callbackMappings does not seem to exist. Did you mean defaultCallbackMappings?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
161
            }
162
163
            // set the appropriate callback mapping for the attributes input type
164
            if (isset($this->defaultFrontendInputCallbackMapping[$frontendInput])) {
165
                $this->callbackMappings[$attributeCode][] = $this->defaultFrontendInputCallbackMapping[$frontendInput];
0 ignored issues
show
Bug introduced by
The property callbackMappings does not seem to exist. Did you mean defaultCallbackMappings?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
166
            }
167
        }
168
169
        // merge the callback mappings the the one from the configuration file
170
        foreach ($this->getConfiguration()->getCallbacks() as $callbackMappings) {
171
            foreach ($callbackMappings as $attributeCode => $mappings) {
172
                // write a log message, that default callback configuration will
173
                // be overwritten with the one from the configuration file
174
                if (isset($this->callbackMappings[$attributeCode])) {
0 ignored issues
show
Bug introduced by
The property callbackMappings does not seem to exist. Did you mean defaultCallbackMappings?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
175
                    $this->getSystemLogger()->notice(
176
                        sprintf('Now override callback mappings for attribute %s with values found in configuration file', $attributeCode)
177
                    );
178
                }
179
180
                // override the attributes callbacks
181
                $this->callbackMappings[$attributeCode] = $mappings;
0 ignored issues
show
Bug introduced by
The property callbackMappings does not seem to exist. Did you mean defaultCallbackMappings?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
182
            }
183
        }
184
185
        // invoke the parent method
186
        parent::setUp();
187
    }
188
189
    /**
190
     * Set's the attribute set of the product that has to be created.
191
     *
192
     * @param array $attributeSet The attribute set
193
     *
194
     * @return void
195
     */
196 1
    public function setAttributeSet(array $attributeSet)
197
    {
198 1
        $this->attributeSet = $attributeSet;
199 1
    }
200
201
    /**
202
     * Return's the attribute set of the product that has to be created.
203
     *
204
     * @return array The attribute set
205
     */
206
    public function getAttributeSet()
207
    {
208
        return $this->attributeSet;
209
    }
210
211
    /**
212
     * Cast's the passed value based on the backend type information.
213
     *
214
     * @param string $backendType The backend type to cast to
215
     * @param mixed  $value       The value to be casted
216
     *
217
     * @return mixed The casted value
218
     */
219 1
    public function castValueByBackendType($backendType, $value)
220
    {
221
222
        // cast the value to a valid timestamp
223 1
        if ($backendType === 'datetime') {
224
            return \DateTime::createFromFormat($this->getSourceDateFormat(), $value)->format('Y-m-d H:i:s');
225
        }
226
227
        // cast the value to a float value
228 1
        if ($backendType === 'float') {
229 1
            return (float) $value;
230
        }
231
232
        // cast the value to an integer
233 1
        if ($backendType === 'int') {
234 1
            return (int) $value;
235
        }
236
237
        // we don't need to cast strings
238
        return $value;
239
    }
240
241
    /**
242
     * Return's the mappings for the table column => CSV column header.
243
     *
244
     * @return array The header stock mappings
245
     */
246 1
    public function getHeaderStockMappings()
247
    {
248 1
        return $this->headerStockMappings;
249
    }
250
251
    /**
252
     * Return's mapping for the supported backend types (for the product entity) => persist methods.
253
     *
254
     * @return array The mapping for the supported backend types
255
     */
256
    public function getBackendTypes()
257
    {
258
        return $this->backendTypes;
259
    }
260
261
    /**
262
     * Return's the visibility key for the passed visibility string.
263
     *
264
     * @param string $visibility The visibility string to return the key for
265
     *
266
     * @return integer The requested visibility key
267
     * @throws \Exception Is thrown, if the requested visibility is not available
268
     */
269 View Code Duplication
    public function getVisibilityIdByValue($visibility)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
270
    {
271
272
        // query whether or not, the requested visibility is available
273
        if (isset($this->availableVisibilities[$visibility])) {
274
            return $this->availableVisibilities[$visibility];
275
        }
276
277
        // throw an exception, if not
278
        throw new \Exception(
279
            sprintf(
280
                'Found invalid visibility %s in file %s on line %d',
281
                $visibility,
282
                $this->getFilename(),
283
                $this->getLineNumber()
284
            )
285
        );
286
    }
287
288
    /**
289
     * Add the passed category ID to the product's category list.
290
     *
291
     * @param integer $categoryId The category ID to add
292
     *
293
     * @return void
294
     */
295
    public function addProductCategoryId($categoryId)
296
    {
297
        $this->productCategoryIds[$this->getLastEntityId()][$categoryId] = $this->getLastEntityId();
298
    }
299
300
    /**
301
     * Return's the list with category IDs the product is related with.
302
     *
303
     * @return array The product's category IDs
304
     */
305
    public function getProductCategoryIds()
306
    {
307
308
        // initialize the array with the product's category IDs
309
        $categoryIds = array();
310
311
        // query whether or not category IDs are available for the actual product entity
312
        if (isset($this->productCategoryIds[$lastEntityId = $this->getLastEntityId()])) {
313
            $categoryIds = $this->productCategoryIds[$lastEntityId];
314
        }
315
316
        // return the array with the product's category IDs
317
        return $categoryIds;
318
    }
319
320
    /**
321
     * Return's the attribute option value with the passed value and store ID.
322
     *
323
     * @param mixed   $value   The option value
324
     * @param integer $storeId The ID of the store
325
     *
326
     * @return array|boolean The attribute option value instance
327
     */
328
    public function getEavAttributeOptionValueByOptionValueAndStoreId($value, $storeId)
329
    {
330
        return $this->getProductProcessor()->getEavAttributeOptionValueByOptionValueAndStoreId($value, $storeId);
331
    }
332
333
    /**
334
     * Return's an array with the available EAV attributes for the passed is user defined flag.
335
     *
336
     * @param integer $isUserDefined The flag itself
337
     *
338
     * @return array The array with the EAV attributes matching the passed flag
339
     */
340
    public function getEavAttributeByIsUserDefined($isUserDefined = 1)
341
    {
342
        return $this->getProductProcessor()->getEavAttributeByIsUserDefined($isUserDefined);
343
    }
344
345
    /**
346
     * Return's the URL rewrites for the passed URL entity type and ID.
347
     *
348
     * @param string  $entityType The entity type to load the URL rewrites for
349
     * @param integer $entityId   The entity ID to laod the rewrites for
350
     *
351
     * @return array The URL rewrites
352
     */
353 1
    public function getUrlRewritesByEntityTypeAndEntityId($entityType, $entityId)
354
    {
355 1
        return $this->getProductProcessor()->getUrlRewritesByEntityTypeAndEntityId($entityType, $entityId);
356
    }
357
358
    /**
359
     * Load's and return's the product with the passed SKU.
360
     *
361
     * @param string $sku The SKU of the product to load
362
     *
363
     * @return array The product
364
     */
365
    public function loadProduct($sku)
366
    {
367
        return $this->getProductProcessor()->loadProduct($sku);
368
    }
369
370
    /**
371
     * Load's and return's the product website relation with the passed product and website ID.
372
     *
373
     * @param string $productId The product ID of the relation
374
     * @param string $websiteId The website ID of the relation
375
     *
376
     * @return array The product website
377
     */
378
    public function loadProductWebsite($productId, $websiteId)
379
    {
380
        return $this->getProductProcessor()->loadProductWebsite($productId, $websiteId);
381
    }
382
383
    /**
384
     * Return's the category product relation with the passed category/product ID.
385
     *
386
     * @param integer $categoryId The category ID of the category product relation to return
387
     * @param integer $productId  The product ID of the category product relation to return
388
     *
389
     * @return array The category product relation
390
     */
391
    public function loadCategoryProduct($categoryId, $productId)
392
    {
393
        return $this->getProductProcessor()->loadCategoryProduct($categoryId, $productId);
394
    }
395
396
    /**
397
     * Load's and return's the stock status with the passed product/website/stock ID.
398
     *
399
     * @param integer $productId The product ID of the stock status to load
400
     * @param integer $websiteId The website ID of the stock status to load
401
     * @param integer $stockId   The stock ID of the stock status to load
402
     *
403
     * @return array The stock status
404
     */
405
    public function loadStockStatus($productId, $websiteId, $stockId)
406
    {
407
        return $this->getProductProcessor()->loadStockStatus($productId, $websiteId, $stockId);
408
    }
409
410
    /**
411
     * Load's and return's the stock status with the passed product/website/stock ID.
412
     *
413
     * @param integer $productId The product ID of the stock item to load
414
     * @param integer $websiteId The website ID of the stock item to load
415
     * @param integer $stockId   The stock ID of the stock item to load
416
     *
417
     * @return array The stock item
418
     */
419
    public function loadStockItem($productId, $websiteId, $stockId)
420
    {
421
        return $this->getProductProcessor()->loadStockItem($productId, $websiteId, $stockId);
422
    }
423
424
    /**
425
     * Load's and return's the datetime attribute with the passed entity/attribute/store ID.
426
     *
427
     * @param integer $entityId    The entity ID of the attribute
428
     * @param integer $attributeId The attribute ID of the attribute
429
     * @param integer $storeId     The store ID of the attribute
430
     *
431
     * @return array|null The datetime attribute
432
     */
433
    public function loadProductDatetimeAttribute($entityId, $attributeId, $storeId)
434
    {
435
        return $this->getProductProcessor()->loadProductDatetimeAttribute($entityId, $attributeId, $storeId);
436
    }
437
438
    /**
439
     * Load's and return's the decimal attribute with the passed entity/attribute/store ID.
440
     *
441
     * @param integer $entityId    The entity ID of the attribute
442
     * @param integer $attributeId The attribute ID of the attribute
443
     * @param integer $storeId     The store ID of the attribute
444
     *
445
     * @return array|null The decimal attribute
446
     */
447
    public function loadProductDecimalAttribute($entityId, $attributeId, $storeId)
448
    {
449
        return $this->getProductProcessor()->loadProductDecimalAttribute($entityId, $attributeId, $storeId);
450
    }
451
452
    /**
453
     * Load's and return's the integer attribute with the passed entity/attribute/store ID.
454
     *
455
     * @param integer $entityId    The entity ID of the attribute
456
     * @param integer $attributeId The attribute ID of the attribute
457
     * @param integer $storeId     The store ID of the attribute
458
     *
459
     * @return array|null The integer attribute
460
     */
461
    public function loadProductIntAttribute($entityId, $attributeId, $storeId)
462
    {
463
        return $this->getProductProcessor()->loadProductIntAttribute($entityId, $attributeId, $storeId);
464
    }
465
466
    /**
467
     * Load's and return's the text attribute with the passed entity/attribute/store ID.
468
     *
469
     * @param integer $entityId    The entity ID of the attribute
470
     * @param integer $attributeId The attribute ID of the attribute
471
     * @param integer $storeId     The store ID of the attribute
472
     *
473
     * @return array|null The text attribute
474
     */
475
    public function loadProductTextAttribute($entityId, $attributeId, $storeId)
476
    {
477
        return $this->getProductProcessor()->loadProductTextAttribute($entityId, $attributeId, $storeId);
478
    }
479
480
    /**
481
     * Load's and return's the varchar attribute with the passed entity/attribute/store ID.
482
     *
483
     * @param integer $entityId    The entity ID of the attribute
484
     * @param integer $attributeId The attribute ID of the attribute
485
     * @param integer $storeId     The store ID of the attribute
486
     *
487
     * @return array|null The varchar attribute
488
     */
489
    public function loadProductVarcharAttribute($entityId, $attributeId, $storeId)
490
    {
491
        return $this->getProductProcessor()->loadProductVarcharAttribute($entityId, $attributeId, $storeId);
492
    }
493
494
    /**
495
     * Return's the URL rewrite product category relation for the passed
496
     * product and category ID.
497
     *
498
     * @param integer $productId  The product ID to load the URL rewrite product category relation for
499
     * @param integer $categoryId The category ID to load the URL rewrite product category relation for
500
     *
501
     * @return array|false The URL rewrite product category relations
502
     */
503
    public function loadUrlRewriteProductCategory($productId, $categoryId)
504
    {
505
        return $this->getProductProcessor()->loadUrlRewriteProductCategory($productId, $categoryId);
506
    }
507
508
    /**
509
     * Persist's the passed product data and return's the ID.
510
     *
511
     * @param array $product The product data to persist
512
     *
513
     * @return string The ID of the persisted entity
514
     */
515
    public function persistProduct($product)
516
    {
517
        return $this->getProductProcessor()->persistProduct($product);
518
    }
519
520
    /**
521
     * Persist's the passed product varchar attribute.
522
     *
523
     * @param array $attribute The attribute to persist
524
     *
525
     * @return void
526
     */
527
    public function persistProductVarcharAttribute($attribute)
528
    {
529
        $this->getProductProcessor()->persistProductVarcharAttribute($attribute);
530
    }
531
532
    /**
533
     * Persist's the passed product integer attribute.
534
     *
535
     * @param array $attribute The attribute to persist
536
     *
537
     * @return void
538
     */
539
    public function persistProductIntAttribute($attribute)
540
    {
541
        $this->getProductProcessor()->persistProductIntAttribute($attribute);
542
    }
543
544
    /**
545
     * Persist's the passed product decimal attribute.
546
     *
547
     * @param array $attribute The attribute to persist
548
     *
549
     * @return void
550
     */
551
    public function persistProductDecimalAttribute($attribute)
552
    {
553
        $this->getProductProcessor()->persistProductDecimalAttribute($attribute);
554
    }
555
556
    /**
557
     * Persist's the passed product datetime attribute.
558
     *
559
     * @param array $attribute The attribute to persist
560
     *
561
     * @return void
562
     */
563
    public function persistProductDatetimeAttribute($attribute)
564
    {
565
        $this->getProductProcessor()->persistProductDatetimeAttribute($attribute);
566
    }
567
568
    /**
569
     * Persist's the passed product text attribute.
570
     *
571
     * @param array $attribute The attribute to persist
572
     *
573
     * @return void
574
     */
575
    public function persistProductTextAttribute($attribute)
576
    {
577
        $this->getProductProcessor()->persistProductTextAttribute($attribute);
578
    }
579
580
    /**
581
     * Persist's the passed product website data and return's the ID.
582
     *
583
     * @param array $productWebsite The product website data to persist
584
     *
585
     * @return void
586
     */
587
    public function persistProductWebsite($productWebsite)
588
    {
589
        $this->getProductProcessor()->persistProductWebsite($productWebsite);
590
    }
591
592
    /**
593
     * Persist's the passed category product relation.
594
     *
595
     * @param array $categoryProduct The category product relation to persist
596
     *
597
     * @return void
598
     */
599
    public function persistCategoryProduct($categoryProduct)
600
    {
601
        $this->getProductProcessor()->persistCategoryProduct($categoryProduct);
602
    }
603
604
    /**
605
     * Persist's the passed stock item data and return's the ID.
606
     *
607
     * @param array $stockItem The stock item data to persist
608
     *
609
     * @return void
610
     */
611
    public function persistStockItem($stockItem)
612
    {
613
        $this->getProductProcessor()->persistStockItem($stockItem);
614
    }
615
616
    /**
617
     * Persist's the passed stock status data and return's the ID.
618
     *
619
     * @param array $stockStatus The stock status data to persist
620
     *
621
     * @return void
622
     */
623
    public function persistStockStatus($stockStatus)
624
    {
625
        $this->getProductProcessor()->persistStockStatus($stockStatus);
626
    }
627
628
    /**
629
     * Persist's the URL rewrite with the passed data.
630
     *
631
     * @param array $row The URL rewrite to persist
632
     *
633
     * @return string The ID of the persisted entity
634
     */
635 1
    public function persistUrlRewrite($row)
636
    {
637 1
        return $this->getProductProcessor()->persistUrlRewrite($row);
638
    }
639
640
    /**
641
     * Persist's the URL rewrite product => category relation with the passed data.
642
     *
643
     * @param array $row The URL rewrite product => category relation to persist
644
     *
645
     * @return void
646
     */
647
    public function persistUrlRewriteProductCategory($row)
648
    {
649
        $this->getProductProcessor()->persistUrlRewriteProductCategory($row);
650
    }
651
652
    /**
653
     * Delete's the entity with the passed attributes.
654
     *
655
     * @param array       $row  The attributes of the entity to delete
656
     * @param string|null $name The name of the prepared statement that has to be executed
657
     *
658
     * @return void
659
     */
660
    public function deleteProduct($row, $name = null)
661
    {
662
        $this->getProductProcessor()->deleteProduct($row, $name);
663
    }
664
665
    /**
666
     * Delete's the URL rewrite(s) with the passed attributes.
667
     *
668
     * @param array       $row  The attributes of the entity to delete
669
     * @param string|null $name The name of the prepared statement that has to be executed
670
     *
671
     * @return void
672
     */
673 1
    public function deleteUrlRewrite($row, $name = null)
674
    {
675 1
        $this->getProductProcessor()->deleteUrlRewrite($row, $name);
676 1
    }
677
678
    /**
679
     * Delete's the stock item(s) with the passed attributes.
680
     *
681
     * @param array       $row  The attributes of the entity to delete
682
     * @param string|null $name The name of the prepared statement that has to be executed
683
     *
684
     * @return void
685
     */
686
    public function deleteStockItem($row, $name = null)
687
    {
688
        $this->getProductProcessor()->deleteStockItem($row, $name);
689
    }
690
691
    /**
692
     * Delete's the stock status with the passed attributes.
693
     *
694
     * @param array       $row  The attributes of the entity to delete
695
     * @param string|null $name The name of the prepared statement that has to be executed
696
     *
697
     * @return void
698
     */
699
    public function deleteStockStatus($row, $name = null)
700
    {
701
        $this->getProductProcessor()->deleteStockStatus($row, $name);
702
    }
703
704
    /**
705
     * Delete's the product website relations with the passed attributes.
706
     *
707
     * @param array       $row  The attributes of the entity to delete
708
     * @param string|null $name The name of the prepared statement that has to be executed
709
     *
710
     * @return void
711
     */
712
    public function deleteProductWebsite($row, $name = null)
713
    {
714
        $this->getProductProcessor()->deleteProductWebsite($row, $name);
715
    }
716
717
    /**
718
     * Delete's the category product relations with the passed attributes.
719
     *
720
     * @param array       $row  The attributes of the entity to delete
721
     * @param string|null $name The name of the prepared statement that has to be executed
722
     *
723
     * @return void
724
     */
725
    public function deleteCategoryProduct($row, $name = null)
726
    {
727
        $this->getProductProcessor()->deleteCategoryProduct($row, $name);
728
    }
729
}
730