Completed
Push — master ( 5202b4...404f67 )
by Tim
10s
created

BunchSubject   F

Complexity

Total Complexity 61

Size/Duplication

Total Lines 783
Duplicated Lines 0 %

Coupling/Cohesion

Components 4
Dependencies 5

Test Coverage

Coverage 11.38%

Importance

Changes 0
Metric Value
wmc 61
lcom 4
cbo 5
dl 0
loc 783
ccs 19
cts 167
cp 0.1138
rs 3.2432
c 0
b 0
f 0

45 Methods

Rating   Name   Duplication   Size   Complexity  
A setAttributeSet() 0 4 1
A getAttributeSet() 0 4 1
A tearDown() 0 18 1
B exportArtefacts() 0 34 4
A getTargetDir() 0 4 1
C getExportConfig() 0 39 7
A castValueByBackendType() 0 21 4
A getHeaderStockMappings() 0 4 1
A getBackendTypes() 0 4 1
A getArtefacts() 0 4 1
A getVisibilityIdByValue() 0 11 2
A mapAttributeCodeByHeaderMapping() 0 11 2
A addArtefacts() 0 11 2
A addSkuEntityIdMapping() 0 4 1
A addProductCategoryId() 0 4 1
A getProductCategoryIds() 0 14 2
A getEavAttributeOptionValueByOptionValueAndStoreId() 0 4 1
A getUrlRewritesByEntityTypeAndEntityId() 0 4 1
A loadProduct() 0 4 1
A loadProductWebsite() 0 4 1
A loadCategoryProduct() 0 4 1
A loadStockStatus() 0 4 1
A loadStockItem() 0 4 1
A loadProductDatetimeAttribute() 0 4 1
A loadProductDecimalAttribute() 0 4 1
A loadProductIntAttribute() 0 4 1
A loadProductTextAttribute() 0 4 1
A loadProductVarcharAttribute() 0 4 1
A persistProduct() 0 4 1
A persistProductVarcharAttribute() 0 4 1
A persistProductIntAttribute() 0 4 1
A persistProductDecimalAttribute() 0 4 1
A persistProductDatetimeAttribute() 0 4 1
A persistProductTextAttribute() 0 4 1
A persistProductWebsite() 0 4 1
A persistCategoryProduct() 0 4 1
A persistStockItem() 0 4 1
A persistStockStatus() 0 4 1
A persistUrlRewrite() 0 4 1
A deleteProduct() 0 4 1
A deleteUrlRewrite() 0 4 1
A deleteStockItem() 0 4 1
A deleteStockStatus() 0 4 1
A deleteProductWebsite() 0 4 1
A deleteCategoryProduct() 0 4 1

How to fix   Complexity   

Complex Class

Complex classes like BunchSubject often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use BunchSubject, and based on these observations, apply Extract Interface, too.

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 Goodby\CSV\Export\Standard\Exporter;
24
use Goodby\CSV\Export\Standard\ExporterConfig;
25
use TechDivision\Import\Utils\RegistryKeys;
26
use TechDivision\Import\Services\RegistryProcessor;
27
use TechDivision\Import\Product\Utils\VisibilityKeys;
28
29
/**
30
 * The subject implementation that handles the business logic to persist products.
31
 *
32
 * @author    Tim Wagner <[email protected]>
33
 * @copyright 2016 TechDivision GmbH <[email protected]>
34
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
35
 * @link      https://github.com/techdivision/import-product
36
 * @link      http://www.techdivision.com
37
 */
38
class BunchSubject extends AbstractProductSubject
39
{
40
41
    /**
42
     * The mapping for the supported backend types (for the product entity) => persist methods.
43
     *
44
     * @var array
45
     */
46
    protected $backendTypes = array(
47
        'datetime' => array('persistProductDatetimeAttribute', 'loadProductDatetimeAttribute'),
48
        'decimal'  => array('persistProductDecimalAttribute', 'loadProductDecimalAttribute'),
49
        'int'      => array('persistProductIntAttribute', 'loadProductIntAttribute'),
50
        'text'     => array('persistProductTextAttribute', 'loadProductTextAttribute'),
51
        'varchar'  => array('persistProductVarcharAttribute', 'loadProductVarcharAttribute')
52
    );
53
54
    /**
55
     * Mappings for attribute code => CSV column header.
56
     *
57
     * @var array
58
     */
59
    protected $headerMappings = array(
60
        'status' => 'product_online',
61
        'tax_class_id' => 'tax_class_name',
62
        'price_type'  => 'bundle_price_type',
63
        'sku_type' => 'bundle_sku_type',
64
        'price_view' => 'bundle_price_view',
65
        'weight_type' => 'bundle_weight_type',
66
        'image' => 'base_image',
67
        'image_label' => 'base_image_label',
68
        'thumbnail' => 'thumbnail_image',
69
        'thumbnail_label' => 'thumbnail_image_label',
70
        'shipment_type' => 'bundle_shipment_type'
71
    );
72
73
    /**
74
     * Mappings for the table column => CSV column header.
75
     *
76
     * @var array
77
     */
78
    protected $headerStockMappings = array(
79
        'qty'                         => array('qty', 'float'),
80
        'min_qty'                     => array('out_of_stock_qty', 'float'),
81
        'use_config_min_qty'          => array('use_config_min_qty', 'int'),
82
        'is_qty_decimal'              => array('is_qty_decimal', 'int'),
83
        'backorders'                  => array('allow_backorders', 'int'),
84
        'use_config_backorders'       => array('use_config_backorders', 'int'),
85
        'min_sale_qty'                => array('min_cart_qty', 'float'),
86
        'use_config_min_sale_qty'     => array('use_config_min_sale_qty', 'int'),
87
        'max_sale_qty'                => array('max_cart_qty', 'float'),
88
        'use_config_max_sale_qty'     => array('use_config_max_sale_qty', 'int'),
89
        'is_in_stock'                 => array('is_in_stock', 'int'),
90
        'notify_stock_qty'            => array('notify_on_stock_below', 'float'),
91
        'use_config_notify_stock_qty' => array('use_config_notify_stock_qty', 'int'),
92
        'manage_stock'                => array('manage_stock', 'int'),
93
        'use_config_manage_stock'     => array('use_config_manage_stock', 'int'),
94
        'use_config_qty_increments'   => array('use_config_qty_increments', 'int'),
95
        'qty_increments'              => array('qty_increments', 'float'),
96
        'use_config_enable_qty_inc'   => array('use_config_enable_qty_inc', 'int'),
97
        'enable_qty_increments'       => array('enable_qty_increments', 'int'),
98
        'is_decimal_divided'          => array('is_decimal_divided', 'int'),
99
    );
100
101
    /**
102
     * The array with the available visibility keys.
103
     *
104
     * @var array
105
     */
106
    protected $availableVisibilities = array(
107
        'Not Visible Individually' => VisibilityKeys::VISIBILITY_NOT_VISIBLE,
108
        'Catalog'                  => VisibilityKeys::VISIBILITY_IN_CATALOG,
109
        'Search'                   => VisibilityKeys::VISIBILITY_IN_SEARCH,
110
        'Catalog, Search'          => VisibilityKeys::VISIBILITY_BOTH
111
    );
112
113
    /**
114
     * The attribute set of the product that has to be created.
115
     *
116
     * @var array
117
     */
118
    protected $attributeSet = array();
119
120
    /**
121
     * The array containing the data for product type configuration (configurables, bundles, etc).
122
     *
123
     * @var array
124
     */
125
    protected $artefacs = array();
126
127
    /**
128
     * The mapping for the SKUs to the created entity IDs.
129
     *
130
     * @var array
131
     */
132
    protected $skuEntityIdMapping = array();
133
134
    /**
135
     * The category IDs the product is related with.
136
     *
137
     * @var array
138
     */
139
    protected $productCategoryIds = array();
140
141
    /**
142
     * Set's the attribute set of the product that has to be created.
143
     *
144
     * @param array $attributeSet The attribute set
145
     *
146
     * @return void
147
     */
148 1
    public function setAttributeSet(array $attributeSet)
149
    {
150 1
        $this->attributeSet = $attributeSet;
151 1
    }
152
153
    /**
154
     * Return's the attribute set of the product that has to be created.
155
     *
156
     * @return array The attribute set
157
     */
158
    public function getAttributeSet()
159
    {
160
        return $this->attributeSet;
161
    }
162
163
    /**
164
     * Clean up the global data after importing the bunch.
165
     *
166
     * @return void
167
     */
168
    public function tearDown()
169
    {
170
171
        // invoke parent method
172
        parent::tearDown();
173
174
        // export the artefacts
175
        $this->exportArtefacts();
176
177
        // load the registry processor
178
        $registryProcessor = $this->getRegistryProcessor();
179
180
        // update the status with the SKU => entity ID mapping
181
        $registryProcessor->mergeAttributesRecursive(
182
            $this->getSerial(),
183
            array(RegistryKeys::SKU_ENTITY_ID_MAPPING => $this->skuEntityIdMapping)
184
        );
185
    }
186
187
    /**
188
     * Export's the artefacts to CSV files.
189
     *
190
     * @return void
191
     */
192
    protected function exportArtefacts()
193
    {
194
195
        // load the target directory and the actual timestamp
196
        $targetDir = $this->getTargetDir();
197
        $timestamp = date('Ymd-His');
198
199
        // initialize the counter
200
        $counter = 0;
201
202
        // iterate over the artefacts and export them
203
        foreach ($this->getArtefacts() as $artefactType => $artefacts) {
204
            foreach ($artefacts as $entityArtefacts) {
205
                // initialize the the exporter
206
                $exporter = new Exporter($this->getExportConfig());
207
208
                // initialize the bunch
209
                $bunch = array();
210
211
                // set the bunch header and append the artefact data
212
                $first = reset($entityArtefacts);
213
                $second = reset($first);
214
                $bunch[] = array_keys($second);
215
216
                // export the artefacts
217
                foreach ($entityArtefacts as $entityArtefact) {
218
                    $bunch = array_merge($bunch, $entityArtefact);
219
                }
220
221
                // export the artefact (bunch)
222
                $exporter->export(sprintf('%s/%s-%s_%d.csv', $targetDir, $artefactType, $timestamp, $counter++), $bunch);
223
            }
224
        }
225
    }
226
227
    /**
228
     * Return's the target directory for the artefact export.
229
     *
230
     * @return string The target directory for the artefact export
231
     */
232
    protected function getTargetDir()
233
    {
234
        return $this->getNewSourceDir();
0 ignored issues
show
Bug introduced by
The method getNewSourceDir() does not seem to exist on object<TechDivision\Impo...\Subjects\BunchSubject>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
235
    }
236
237
    /**
238
     * Initialize and return the exporter configuration.
239
     *
240
     * @return \Goodby\CSV\Export\Standard\ExporterConfig The exporter configuration
241
     */
242
    protected function getExportConfig()
243
    {
244
245
        // initialize the lexer configuration
246
        $config = new ExporterConfig();
247
248
        // query whether or not a delimiter character has been configured
249
        if ($delimiter = $this->getConfiguration()->getDelimiter()) {
250
            $config->setDelimiter($delimiter);
251
        }
252
253
        // query whether or not a custom escape character has been configured
254
        if ($escape = $this->getConfiguration()->getEscape()) {
255
            $config->setEscape($escape);
256
        }
257
258
        // query whether or not a custom enclosure character has been configured
259
        if ($enclosure = $this->getConfiguration()->getEnclosure()) {
260
            $config->setEnclosure($enclosure);
261
        }
262
263
        // query whether or not a custom source charset has been configured
264
        if ($fromCharset = $this->getConfiguration()->getFromCharset()) {
265
            $config->setFromCharset($fromCharset);
266
        }
267
268
        // query whether or not a custom target charset has been configured
269
        if ($toCharset = $this->getConfiguration()->getToCharset()) {
270
            $config->setToCharset($toCharset);
271
        }
272
273
        // query whether or not a custom file mode has been configured
274
        if ($fileMode = $this->getConfiguration()->getFileMode()) {
275
            $config->setFileMode($fileMode);
276
        }
277
278
        // return the lexer configuratio
279
        return $config;
280 1
    }
281
282
    /**
283
     * Cast's the passed value based on the backend type information.
284 1
     *
285
     * @param string $backendType The backend type to cast to
286
     * @param mixed  $value       The value to be casted
287
     *
288
     * @return mixed The casted value
289 1
     */
290 1
    public function castValueByBackendType($backendType, $value)
291
    {
292
293
        // cast the value to a valid timestamp
294 1
        if ($backendType === 'datetime') {
295 1
            return \DateTime::createFromFormat($this->getSourceDateFormat(), $value)->format('Y-m-d H:i:s');
296
        }
297
298
        // cast the value to a float value
299
        if ($backendType === 'float') {
300
            return (float) $value;
301
        }
302
303
        // cast the value to an integer
304
        if ($backendType === 'int') {
305
            return (int) $value;
306
        }
307 1
308
        // we don't need to cast strings
309 1
        return $value;
310
    }
311
312
    /**
313
     * Return's the mappings for the table column => CSV column header.
314
     *
315
     * @return array The header stock mappings
316
     */
317
    public function getHeaderStockMappings()
318
    {
319
        return $this->headerStockMappings;
320
    }
321
322
    /**
323
     * Return's mapping for the supported backend types (for the product entity) => persist methods.
324
     *
325
     * @return array The mapping for the supported backend types
326
     */
327
    public function getBackendTypes()
328
    {
329
        return $this->backendTypes;
330
    }
331
332
    /**
333
     * Return's the artefacts for post-processing.
334
     *
335
     * @return array The artefacts
336
     */
337
    public function getArtefacts()
338
    {
339
        return $this->artefacs;
340
    }
341
342
    /**
343
     * Return's the visibility key for the passed visibility string.
344
     *
345
     * @param string $visibility The visibility string to return the key for
346
     *
347
     * @return integer The requested visibility key
348
     * @throws \Exception Is thrown, if the requested visibility is not available
349
     */
350
    public function getVisibilityIdByValue($visibility)
351
    {
352
353
        // query whether or not, the requested visibility is available
354
        if (isset($this->availableVisibilities[$visibility])) {
355
            return $this->availableVisibilities[$visibility];
356
        }
357
358
        // throw an exception, if not
359
        throw new \Exception(sprintf('Found invalid visibility %s', $visibility));
360
    }
361
362
    /**
363
     * Map the passed attribute code, if a header mapping exists and return the
364
     * mapped mapping.
365
     *
366
     * @param string $attributeCode The attribute code to map
367
     *
368
     * @return string The mapped attribute code, or the original one
369
     */
370
    public function mapAttributeCodeByHeaderMapping($attributeCode)
371
    {
372
373
        // query weather or not we've a mapping, if yes, map the attribute code
374
        if (isset($this->headerMappings[$attributeCode])) {
375
            $attributeCode = $this->headerMappings[$attributeCode];
376
        }
377
378
        // return the (mapped) attribute code
379
        return $attributeCode;
380
    }
381
382
    /**
383
     * Add the passed product type artefacts to the product with the
384
     * last entity ID.
385
     *
386
     * @param string $type      The artefact type, e. g. configurable
387
     * @param array  $artefacts The product type artefacts
388
     *
389
     * @return void
390
     * @uses \TechDivision\Import\Product\Subjects\BunchSubject::getLastEntityId()
391
     */
392
    public function addArtefacts($type, array $artefacts)
393
    {
394
395
        // query whether or not, any artefacts are available
396
        if (sizeof($artefacts) === 0) {
397
            return;
398
        }
399
400
        // append the artefacts to the stack
401
        $this->artefacs[$type][$this->getLastEntityId()][] = $artefacts;
402
    }
403
404
    /**
405
     * Add the passed SKU => entity ID mapping.
406
     *
407
     * @param string $sku The SKU
408
     *
409
     * @return void
410
     * @uses \Import\Csv\Actions\ProductImportBunchAction::getLastEntityId()
411
     */
412
    public function addSkuEntityIdMapping($sku)
413
    {
414
        $this->skuEntityIdMapping[$sku] = $this->getLastEntityId();
415
    }
416
417
    /**
418
     * Add the passed category ID to the product's category list.
419
     *
420
     * @param integer $categoryId The category ID to add
421
     *
422
     * @return void
423
     */
424
    public function addProductCategoryId($categoryId)
425
    {
426
        $this->productCategoryIds[$this->getLastEntityId()][$categoryId] = $this->getLastEntityId();
427
    }
428
429
    /**
430
     * Return's the list with category IDs the product is related with.
431
     *
432
     * @return array The product's category IDs
433
     */
434
    public function getProductCategoryIds()
435
    {
436
437
        // initialize the array with the product's category IDs
438
        $categoryIds = array();
439
440
        // query whether or not category IDs are available for the actual product entity
441
        if (isset($this->productCategoryIds[$lastEntityId = $this->getLastEntityId()])) {
442
            $categoryIds = $this->productCategoryIds[$lastEntityId];
443
        }
444
445
        // return the array with the product's category IDs
446
        return $categoryIds;
447
    }
448
449
    /**
450
     * Return's the attribute option value with the passed value and store ID.
451
     *
452
     * @param mixed   $value   The option value
453
     * @param integer $storeId The ID of the store
454
     *
455
     * @return array|boolean The attribute option value instance
456
     */
457
    public function getEavAttributeOptionValueByOptionValueAndStoreId($value, $storeId)
458
    {
459
        return $this->getProductProcessor()->getEavAttributeOptionValueByOptionValueAndStoreId($value, $storeId);
460 1
    }
461
462 1
    /**
463
     * Return's the URL rewrites for the passed URL entity type and ID.
464
     *
465
     * @param string  $entityType The entity type to load the URL rewrites for
466
     * @param integer $entityId   The entity ID to laod the rewrites for
467
     *
468
     * @return array The URL rewrites
469
     */
470
    public function getUrlRewritesByEntityTypeAndEntityId($entityType, $entityId)
471
    {
472
        return $this->getProductProcessor()->getUrlRewritesByEntityTypeAndEntityId($entityType, $entityId);
473
    }
474
475
    /**
476
     * Load's and return's the product with the passed SKU.
477
     *
478
     * @param string $sku The SKU of the product to load
479
     *
480
     * @return array The product
481
     */
482
    public function loadProduct($sku)
483
    {
484
        return $this->getProductProcessor()->loadProduct($sku);
485
    }
486
487
    /**
488
     * Load's and return's the product website relation with the passed product and website ID.
489
     *
490
     * @param string $productId The product ID of the relation
491
     * @param string $websiteId The website ID of the relation
492
     *
493
     * @return array The product website
494
     */
495
    public function loadProductWebsite($productId, $websiteId)
496
    {
497
        return $this->getProductProcessor()->loadProductWebsite($productId, $websiteId);
498
    }
499
500
    /**
501
     * Return's the category product relation with the passed category/product ID.
502
     *
503
     * @param integer $categoryId The category ID of the category product relation to return
504
     * @param integer $productId  The product ID of the category product relation to return
505
     *
506
     * @return array The category product relation
507
     */
508
    public function loadCategoryProduct($categoryId, $productId)
509
    {
510
        return $this->getProductProcessor()->loadCategoryProduct($categoryId, $productId);
511
    }
512
513
    /**
514
     * Load's and return's the stock status with the passed product/website/stock ID.
515
     *
516
     * @param integer $productId The product ID of the stock status to load
517
     * @param integer $websiteId The website ID of the stock status to load
518
     * @param integer $stockId   The stock ID of the stock status to load
519
     *
520
     * @return array The stock status
521
     */
522
    public function loadStockStatus($productId, $websiteId, $stockId)
523
    {
524
        return $this->getProductProcessor()->loadStockStatus($productId, $websiteId, $stockId);
525
    }
526
527
    /**
528
     * Load's and return's the stock status with the passed product/website/stock ID.
529
     *
530
     * @param integer $productId The product ID of the stock item to load
531
     * @param integer $websiteId The website ID of the stock item to load
532
     * @param integer $stockId   The stock ID of the stock item to load
533
     *
534
     * @return array The stock item
535
     */
536
    public function loadStockItem($productId, $websiteId, $stockId)
537
    {
538
        return $this->getProductProcessor()->loadStockItem($productId, $websiteId, $stockId);
539
    }
540
541
    /**
542
     * Load's and return's the datetime attribute with the passed entity/attribute/store ID.
543
     *
544
     * @param integer $entityId    The entity ID of the attribute
545
     * @param integer $attributeId The attribute ID of the attribute
546
     * @param integer $storeId     The store ID of the attribute
547
     *
548
     * @return array|null The datetime attribute
549
     */
550
    public function loadProductDatetimeAttribute($entityId, $attributeId, $storeId)
551
    {
552
        return $this->getProductProcessor()->loadProductDatetimeAttribute($entityId, $attributeId, $storeId);
553
    }
554
555
    /**
556
     * Load's and return's the decimal attribute with the passed entity/attribute/store ID.
557
     *
558
     * @param integer $entityId    The entity ID of the attribute
559
     * @param integer $attributeId The attribute ID of the attribute
560
     * @param integer $storeId     The store ID of the attribute
561
     *
562
     * @return array|null The decimal attribute
563
     */
564
    public function loadProductDecimalAttribute($entityId, $attributeId, $storeId)
565
    {
566
        return $this->getProductProcessor()->loadProductDecimalAttribute($entityId, $attributeId, $storeId);
567
    }
568
569
    /**
570
     * Load's and return's the integer attribute with the passed entity/attribute/store ID.
571
     *
572
     * @param integer $entityId    The entity ID of the attribute
573
     * @param integer $attributeId The attribute ID of the attribute
574
     * @param integer $storeId     The store ID of the attribute
575
     *
576
     * @return array|null The integer attribute
577
     */
578
    public function loadProductIntAttribute($entityId, $attributeId, $storeId)
579
    {
580
        return $this->getProductProcessor()->loadProductIntAttribute($entityId, $attributeId, $storeId);
581
    }
582
583
    /**
584
     * Load's and return's the text attribute with the passed entity/attribute/store ID.
585
     *
586
     * @param integer $entityId    The entity ID of the attribute
587
     * @param integer $attributeId The attribute ID of the attribute
588
     * @param integer $storeId     The store ID of the attribute
589
     *
590
     * @return array|null The text attribute
591
     */
592
    public function loadProductTextAttribute($entityId, $attributeId, $storeId)
593
    {
594
        return $this->getProductProcessor()->loadProductTextAttribute($entityId, $attributeId, $storeId);
595
    }
596
597
    /**
598
     * Load's and return's the varchar attribute with the passed entity/attribute/store ID.
599
     *
600
     * @param integer $entityId    The entity ID of the attribute
601
     * @param integer $attributeId The attribute ID of the attribute
602
     * @param integer $storeId     The store ID of the attribute
603
     *
604
     * @return array|null The varchar attribute
605
     */
606
    public function loadProductVarcharAttribute($entityId, $attributeId, $storeId)
607
    {
608
        return $this->getProductProcessor()->loadProductVarcharAttribute($entityId, $attributeId, $storeId);
609
    }
610
611
    /**
612
     * Persist's the passed product data and return's the ID.
613
     *
614
     * @param array $product The product data to persist
615
     *
616
     * @return string The ID of the persisted entity
617
     */
618
    public function persistProduct($product)
619
    {
620
        return $this->getProductProcessor()->persistProduct($product);
621
    }
622
623
    /**
624
     * Persist's the passed product varchar attribute.
625
     *
626
     * @param array $attribute The attribute to persist
627
     *
628
     * @return void
629
     */
630
    public function persistProductVarcharAttribute($attribute)
631
    {
632
        $this->getProductProcessor()->persistProductVarcharAttribute($attribute);
633
    }
634
635
    /**
636
     * Persist's the passed product integer attribute.
637
     *
638
     * @param array $attribute The attribute to persist
639
     *
640
     * @return void
641
     */
642
    public function persistProductIntAttribute($attribute)
643
    {
644
        $this->getProductProcessor()->persistProductIntAttribute($attribute);
645
    }
646
647
    /**
648
     * Persist's the passed product decimal attribute.
649
     *
650
     * @param array $attribute The attribute to persist
651
     *
652
     * @return void
653
     */
654
    public function persistProductDecimalAttribute($attribute)
655
    {
656
        $this->getProductProcessor()->persistProductDecimalAttribute($attribute);
657
    }
658
659
    /**
660
     * Persist's the passed product datetime attribute.
661
     *
662
     * @param array $attribute The attribute to persist
663
     *
664
     * @return void
665
     */
666
    public function persistProductDatetimeAttribute($attribute)
667
    {
668
        $this->getProductProcessor()->persistProductDatetimeAttribute($attribute);
669
    }
670
671
    /**
672
     * Persist's the passed product text attribute.
673
     *
674
     * @param array $attribute The attribute to persist
675
     *
676
     * @return void
677
     */
678
    public function persistProductTextAttribute($attribute)
679
    {
680
        $this->getProductProcessor()->persistProductTextAttribute($attribute);
681
    }
682
683
    /**
684
     * Persist's the passed product website data and return's the ID.
685
     *
686
     * @param array $productWebsite The product website data to persist
687
     *
688
     * @return void
689
     */
690
    public function persistProductWebsite($productWebsite)
691
    {
692
        $this->getProductProcessor()->persistProductWebsite($productWebsite);
693
    }
694
695
    /**
696
     * Persist's the passed category product relation.
697
     *
698
     * @param array $categoryProduct The category product relation to persist
699
     *
700
     * @return void
701
     */
702
    public function persistCategoryProduct($categoryProduct)
703
    {
704
        $this->getProductProcessor()->persistCategoryProduct($categoryProduct);
705
    }
706
707
    /**
708
     * Persist's the passed stock item data and return's the ID.
709
     *
710
     * @param array $stockItem The stock item data to persist
711
     *
712
     * @return void
713
     */
714
    public function persistStockItem($stockItem)
715
    {
716
        $this->getProductProcessor()->persistStockItem($stockItem);
717
    }
718
719
    /**
720
     * Persist's the passed stock status data and return's the ID.
721
     *
722
     * @param array $stockStatus The stock status data to persist
723
     *
724
     * @return void
725
     */
726
    public function persistStockStatus($stockStatus)
727
    {
728 1
        $this->getProductProcessor()->persistStockStatus($stockStatus);
729
    }
730 1
731 1
    /**
732
     * Persist's the URL write with the passed data.
733
     *
734
     * @param array $row The URL rewrite to persist
735
     *
736
     * @return void
737
     */
738
    public function persistUrlRewrite($row)
739
    {
740
        $this->getProductProcessor()->persistUrlRewrite($row);
741
    }
742
743
    /**
744
     * Delete's the entity with the passed attributes.
745
     *
746
     * @param array       $row  The attributes of the entity to delete
747
     * @param string|null $name The name of the prepared statement that has to be executed
748
     *
749
     * @return void
750
     */
751
    public function deleteProduct($row, $name = null)
752
    {
753
        $this->getProductProcessor()->deleteProduct($row, $name);
754 1
    }
755
756 1
    /**
757 1
     * Delete's the URL rewrite(s) with the passed attributes.
758
     *
759
     * @param array       $row  The attributes of the entity to delete
760
     * @param string|null $name The name of the prepared statement that has to be executed
761
     *
762
     * @return void
763
     */
764
    public function deleteUrlRewrite($row, $name = null)
765
    {
766
        $this->getProductProcessor()->deleteUrlRewrite($row, $name);
767
    }
768
769
    /**
770
     * Delete's the stock item(s) with the passed attributes.
771
     *
772
     * @param array       $row  The attributes of the entity to delete
773
     * @param string|null $name The name of the prepared statement that has to be executed
774
     *
775
     * @return void
776
     */
777
    public function deleteStockItem($row, $name = null)
778
    {
779
        $this->getProductProcessor()->deleteStockItem($row, $name);
780
    }
781
782
    /**
783
     * Delete's the stock status with the passed attributes.
784
     *
785
     * @param array       $row  The attributes of the entity to delete
786
     * @param string|null $name The name of the prepared statement that has to be executed
787
     *
788
     * @return void
789
     */
790
    public function deleteStockStatus($row, $name = null)
791
    {
792
        $this->getProductProcessor()->deleteStockStatus($row, $name);
793
    }
794
795
    /**
796
     * Delete's the product website relations with the passed attributes.
797
     *
798
     * @param array       $row  The attributes of the entity to delete
799
     * @param string|null $name The name of the prepared statement that has to be executed
800
     *
801
     * @return void
802
     */
803
    public function deleteProductWebsite($row, $name = null)
804
    {
805
        $this->getProductProcessor()->deleteProductWebsite($row, $name);
806
    }
807
808
    /**
809
     * Delete's the category product relations with the passed attributes.
810
     *
811
     * @param array       $row  The attributes of the entity to delete
812
     * @param string|null $name The name of the prepared statement that has to be executed
813
     *
814
     * @return void
815
     */
816
    public function deleteCategoryProduct($row, $name = null)
817
    {
818
        $this->getProductProcessor()->deleteCategoryProduct($row, $name);
819
    }
820
}
821