Completed
Push — master ( c3d040...ca2200 )
by Tim
12s
created

AttributeObserverTrait::deleteDatetimeAttribute()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
ccs 0
cts 0
cp 0
c 0
b 0
f 0
nc 1
1
<?php
2
3
/**
4
 * TechDivision\Import\Observers\AttributeObserverTrait
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
18
 * @link      http://www.techdivision.com
19
 */
20
21
namespace TechDivision\Import\Observers;
22
23
use TechDivision\Import\Utils\LoggerKeys;
24
use TechDivision\Import\Utils\MemberNames;
25
use TechDivision\Import\Utils\EntityStatus;
26
use TechDivision\Import\Utils\StoreViewCodes;
27
use TechDivision\Import\Utils\BackendTypeKeys;
28
use TechDivision\Import\Utils\ConfigurationKeys;
29
30
/**
31
 * Observer that creates/updates the EAV attributes.
32
 *
33
 * @author    Tim Wagner <[email protected]>
34
 * @copyright 2016 TechDivision GmbH <[email protected]>
35
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
36
 * @link      https://github.com/techdivision/import
37
 * @link      http://www.techdivision.com
38
 */
39
trait AttributeObserverTrait
40
{
41
42
    /**
43
     * The ID of the attribute to create the values for.
44
     *
45
     * @var integer
46
     */
47
    protected $attributeId;
48
49
    /**
50
     * The attribute code of the attribute to create the values for.
51
     *
52
     * @var string
53
     */
54
    protected $attributeCode;
55
56
    /**
57
     * The backend type of the attribute to create the values for.
58
     *
59
     * @var string
60
     */
61
    protected $backendType;
62
63
    /**
64
     * The attribute value to process.
65
     *
66
     * @var mixed
67
     */
68
    protected $attributeValue;
69
70
    /**
71
     * The array with the column keys that has to be cleaned up when their values are empty.
72
     *
73
     * @var array
74
     */
75
    protected $cleanUpEmptyColumnKeys;
76
77
    /**
78
     * The attribute code that has to be processed.
79
     *
80
     * @return string The attribute code
81
     */
82 1
    public function getAttributeCode()
83
    {
84 1
        return $this->attributeCode;
85
    }
86
87
    /**
88
     * The attribute value that has to be processed.
89
     *
90
     * @return string The attribute value
91
     */
92 1
    public function getAttributeValue()
93
    {
94 1
        return $this->attributeValue;
95
    }
96
97
    /**
98
     * Remove all the empty values from the row and return the cleared row.
99
     *
100
     * @return array The cleared row
101
     */
102 7
    protected function clearRow()
103
    {
104
105
        // query whether or not the column keys has been initialized
106 7
        if ($this->cleanUpEmptyColumnKeys === null) {
107
            // initialize the array with the column keys that has to be cleaned-up
108 7
            $this->cleanUpEmptyColumnKeys = array();
109
110
            // query whether or not column names that has to be cleaned up have been configured
111 7
            if ($this->getSubject()->getConfiguration()->hasParam(ConfigurationKeys::CLEAN_UP_EMPTY_COLUMNS)) {
0 ignored issues
show
Bug introduced by
It seems like getSubject() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
112
                // if yes, load the column names
113
                $cleanUpEmptyColumns = $this->getSubject()->getConfiguration()->getParam(ConfigurationKeys::CLEAN_UP_EMPTY_COLUMNS);
0 ignored issues
show
Bug introduced by
It seems like getSubject() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
114
115
                // translate the column names into column keys
116
                foreach ($cleanUpEmptyColumns as $cleanUpEmptyColumn) {
117
                    $this->cleanUpEmptyColumnKeys[] = $this->getHeader($cleanUpEmptyColumn);
0 ignored issues
show
Bug introduced by
It seems like getHeader() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
118
                }
119
            }
120
        }
121
122
        // remove all the empty values from the row, expected the columns has to be cleaned-up
123 7
        return array_filter(
124 7
            $this->row,
0 ignored issues
show
Bug introduced by
The property row does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
125 7
            function ($value, $key) {
126 7
                return ($value !== null && $value !== '') || in_array($key, $this->cleanUpEmptyColumnKeys);
127 7
            },
128 7
            ARRAY_FILTER_USE_BOTH
129
        );
130
    }
131
132
    /**
133
     * Process the observer's business logic.
134
     *
135
     * @return void
136
     */
137 7
    protected function process()
138
    {
139
140
        // initialize the store view code
141 7
        $this->prepareStoreViewCode();
0 ignored issues
show
Bug introduced by
It seems like prepareStoreViewCode() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
142
143
        // load the PK
144 7
        $pk = $this->getValue($this->getPrimaryKeyColumnName());
0 ignored issues
show
Bug introduced by
It seems like getValue() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
145
146
        // load the store view - if no store view has been set, we assume the admin
147
        // store view, which will contain the default (fallback) attribute values
148 7
        $storeViewCode = $this->getSubject()->getStoreViewCode(StoreViewCodes::ADMIN);
0 ignored issues
show
Bug introduced by
It seems like getSubject() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
149
150
        // query whether or not the row has already been processed
151 7
        if ($this->storeViewHasBeenProcessed($pk, $storeViewCode)) {
152
            // log a message
153
            $this->getSystemLogger()->warning(
154
                $this->appendExceptionSuffix(
0 ignored issues
show
Bug introduced by
It seems like appendExceptionSuffix() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
155
                    sprintf(
156
                        'Attributes for %s "%s" + store view code "%s" has already been processed',
157
                        $this->getPrimaryKeyColumnName(),
158
                        $pk,
159
                        $storeViewCode
160
                    )
161
                )
162
            );
163
164
            // return immediately
165
            return;
166
        }
167
168
        // load the attributes by the found attribute set and the backend types
169 7
        $attributes = $this->getAttributes();
170 7
        $backendTypes = $this->getBackendTypes();
171
172
        // load the header keys
173 7
        $headers = array_flip($this->getHeaders());
0 ignored issues
show
Bug introduced by
It seems like getHeaders() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
174
175
        // remove all the empty values from the row
176 7
        $row = $this->clearRow();
177
178
        // iterate over the attributes and append them to the row
179 7
        foreach ($row as $key => $attributeValue) {
180
            // query whether or not attribute with the found code exists
181 6
            if (!isset($attributes[$attributeCode = $headers[$key]])) {
182
                // log a message in debug mode
183 1
                if ($this->isDebugMode()) {
0 ignored issues
show
Bug introduced by
It seems like isDebugMode() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
184 1
                    $this->getSystemLogger()->debug(
185 1
                        $this->appendExceptionSuffix(
0 ignored issues
show
Bug introduced by
It seems like appendExceptionSuffix() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
186
                            sprintf(
187 1
                                'Can\'t find attribute with attribute code %s',
188
                                $attributeCode
189
                            )
190
                        )
191
                    );
192
                }
193
194
                // stop processing
195 1
                continue;
196
0 ignored issues
show
Coding Style introduced by
Blank line found at end of control structure
Loading history...
197
            } else {
198
                // log a message in debug mode
199 5
                if ($this->isDebugMode()) {
0 ignored issues
show
Bug introduced by
It seems like isDebugMode() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
200
                // log a message in debug mode
201 2
                    $this->getSystemLogger()->debug(
202 2
                        $this->appendExceptionSuffix(
0 ignored issues
show
Bug introduced by
It seems like appendExceptionSuffix() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
203
                            sprintf(
204 2
                                'Found attribute with attribute code %s',
205
                                $attributeCode
206
                            )
207
                        )
208
                    );
209
                }
210
            }
211
212
            // if yes, load the attribute by its code
213 5
            $attribute = $attributes[$attributeCode];
214
215
            // load the backend type => to find the apropriate entity
216 5
            $backendType = $attribute[MemberNames::BACKEND_TYPE];
217 5
            if ($backendType === null) {
218
                // log a message in debug mode
219 1
                $this->getSystemLogger()->warning(
220 1
                    $this->appendExceptionSuffix(
0 ignored issues
show
Bug introduced by
It seems like appendExceptionSuffix() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
221
                        sprintf(
222 1
                            'Found EMTPY backend type for attribute %s',
223
                            $attributeCode
224
                        )
225
                    )
226
                );
227
                // stop processing
228 1
                continue;
229
            }
230
231
            // do nothing on static backend type
232 4
            if ($backendType === BackendTypeKeys::BACKEND_TYPE_STATIC) {
233 1
                continue;
234
            }
235
236
            // query whether or not we've found a supported backend type
237 3
            if (isset($backendTypes[$backendType])) {
238
                // initialize attribute ID/code and backend type
239 2
                $this->attributeId = $attribute[MemberNames::ATTRIBUTE_ID];
240 2
                $this->attributeCode = $attributeCode;
241 2
                $this->backendType = $backendType;
242
243
                // initialize the persist method for the found backend type
244 2
                list ($persistMethod, , $deleteMethod) = $backendTypes[$backendType];
245
246
                // set the attribute value
247 2
                $this->attributeValue = $attributeValue;
248
249
                // prepare/initialize the attribute value
250 2
                $value = $this->initializeAttribute($this->prepareAttributes());
0 ignored issues
show
Bug introduced by
It seems like $this->prepareAttributes() targeting TechDivision\Import\Obse...it::prepareAttributes() can also be of type null; however, TechDivision\Import\Obse...::initializeAttribute() does only seem to accept array, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
251
252
                // query whether or not the entity's value has to be persisted or deleted. if the value is
253
                // an empty string and the status is UPDATE, then the value exists and has to be deleted
254 2
                if ($value[MemberNames::VALUE] === '' && $value[EntityStatus::MEMBER_NAME] === EntityStatus::STATUS_UPDATE) {
255
                    $this->$deleteMethod(array(MemberNames::VALUE_ID => $value[MemberNames::VALUE_ID]));
256 2
                } elseif ($value[MemberNames::VALUE] !== '' && $value[MemberNames::VALUE] !== null) {
257 1
                    $this->$persistMethod($value);
258
                } else {
259
                    // log a debug message, because this should never happen
260 1
                    $this->getSubject()->getSystemLogger()->debug(sprintf('Found empty value for attribute "%s"', $attributeCode));
0 ignored issues
show
Bug introduced by
It seems like getSubject() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
261
                }
262
263
                // continue with the next value
264 2
                continue;
265
            }
266
267
            // log the debug message
268 1
            $this->getSystemLogger()->debug(
269 1
                $this->getSubject()->appendExceptionSuffix(
0 ignored issues
show
Bug introduced by
It seems like getSubject() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
270
                    sprintf(
271 1
                        'Found invalid backend type %s for attribute %s',
272
                        $backendType,
273
                        $attributeCode
274
                    )
275
                )
276
            );
277
        }
278 7
    }
279
280
    /**
281
     * Prepare the attributes of the entity that has to be persisted.
282
     *
283
     * @return array|null The prepared attributes
284
     */
285 2
    protected function prepareAttributes()
286
    {
287
288
        // laod the callbacks for the actual attribute code
289 2
        $callbacks = $this->getCallbacksByType($this->attributeCode);
290
291
        // invoke the pre-cast callbacks
292 2
        foreach ($callbacks as $callback) {
293 1
            $this->attributeValue = $callback->handle($this);
294
        }
295
296
        // load the ID of the product that has been created recently
297 2
        $lastEntityId = $this->getPrimaryKey();
298
299
        // load the store ID, use the admin store if NO store view code has been set
300 2
        $storeId = $this->getRowStoreId(StoreViewCodes::ADMIN);
0 ignored issues
show
Bug introduced by
It seems like getRowStoreId() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
301
302
        // cast the value based on the backend type
303 2
        $castedValue = $this->castValueByBackendType($this->backendType, $this->attributeValue);
0 ignored issues
show
Bug introduced by
It seems like castValueByBackendType() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
304
305
        // prepare the attribute values
306 2
        return $this->initializeEntity(
0 ignored issues
show
Bug introduced by
It seems like initializeEntity() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
307
            array(
308 2
               $this->getPrimaryKeyMemberName() => $lastEntityId,
309 2
                MemberNames::ATTRIBUTE_ID       => $this->attributeId,
310 2
                MemberNames::STORE_ID           => $storeId,
311 2
                MemberNames::VALUE              => $castedValue
312
            )
313
        );
314
    }
315
316
    /**
317
     * Initialize the category product with the passed attributes and returns an instance.
318
     *
319
     * @param array $attr The category product attributes
320
     *
321
     * @return array The initialized category product
322
     */
323 2
    protected function initializeAttribute(array $attr)
324
    {
325 2
        return $attr;
326
    }
327
328
    /**
329
     * Return's the array with callbacks for the passed type.
330
     *
331
     * @param string $type The type of the callbacks to return
332
     *
333
     * @return array The callbacks
334
     */
335 2
    protected function getCallbacksByType($type)
336
    {
337 2
        return $this->getSubject()->getCallbacksByType($type);
0 ignored issues
show
Bug introduced by
It seems like getSubject() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
338
    }
339
340
    /**
341
     * Return's mapping for the supported backend types (for the product entity) => persist methods.
342
     *
343
     * @return array The mapping for the supported backend types
344
     */
345 7
    protected function getBackendTypes()
346
    {
347 7
        return $this->getSubject()->getBackendTypes();
0 ignored issues
show
Bug introduced by
It seems like getSubject() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
348
    }
349
350
    /**
351
     * Return's the attributes for the attribute set of the product that has to be created.
352
     *
353
     * @return array The attributes
354
     * @throws \Exception
355
     */
356 7
    protected function getAttributes()
357
    {
358 7
        return $this->getSubject()->getAttributes();
0 ignored issues
show
Bug introduced by
It seems like getSubject() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
359
    }
360
361
    /**
362
     * Return's the logger with the passed name, by default the system logger.
363
     *
364
     * @param string $name The name of the requested system logger
365
     *
366
     * @return \Psr\Log\LoggerInterface The logger instance
367
     * @throws \Exception Is thrown, if the requested logger is NOT available
368
     */
369
    abstract protected function getSystemLogger($name = LoggerKeys::SYSTEM);
370
371
    /**
372
     * Return's the PK to create the product => attribute relation.
373
     *
374
     * @return integer The PK to create the relation with
375
     */
376
    abstract protected function getPrimaryKey();
377
378
    /**
379
     * Return's the PK column name to create the product => attribute relation.
380
     *
381
     * @return string The PK column name
382
     */
383
    abstract protected function getPrimaryKeyMemberName();
384
385
    /**
386
     * Return's the column name that contains the primary key.
387
     *
388
     * @return string the column name that contains the primary key
389
     */
390
    abstract protected function getPrimaryKeyColumnName();
391
392
    /**
393
     * Queries whether or not the passed PK and store view code has already been processed.
394
     *
395
     * @param string $pk            The PK to check been processed
396
     * @param string $storeViewCode The store view code to check been processed
397
     *
398
     * @return boolean TRUE if the PK and store view code has been processed, else FALSE
399
     */
400
    abstract protected function storeViewHasBeenProcessed($pk, $storeViewCode);
401
402
    /**
403
     * Persist's the passed varchar attribute.
404
     *
405
     * @param array $attribute The attribute to persist
406
     *
407
     * @return void
408
     */
409
    abstract protected function persistVarcharAttribute($attribute);
410
411
    /**
412
     * Persist's the passed integer attribute.
413
     *
414
     * @param array $attribute The attribute to persist
415
     *
416
     * @return void
417
     */
418
    abstract protected function persistIntAttribute($attribute);
419
420
    /**
421
     * Persist's the passed decimal attribute.
422
     *
423
     * @param array $attribute The attribute to persist
424
     *
425
     * @return void
426
     */
427
    abstract protected function persistDecimalAttribute($attribute);
428
429
    /**
430
     * Persist's the passed datetime attribute.
431
     *
432
     * @param array $attribute The attribute to persist
433
     *
434
     * @return void
435
     */
436
    abstract protected function persistDatetimeAttribute($attribute);
437
438
    /**
439
     * Persist's the passed text attribute.
440
     *
441
     * @param array $attribute The attribute to persist
442
     *
443
     * @return void
444
     */
445
    abstract protected function persistTextAttribute($attribute);
446
447
    /**
448
     * Delete's the datetime attribute with the passed value ID.
449
     *
450
     * @param array       $row  The attributes of the entity to delete
451
     * @param string|null $name The name of the prepared statement that has to be executed
452
     *
453
     * @return void
454
     */
455
    abstract protected function deleteDatetimeAttribute(array $row, $name = null);
456
457
    /**
458
     * Delete's the decimal attribute with the passed value ID.
459
     *
460
     * @param array       $row  The attributes of the entity to delete
461
     * @param string|null $name The name of the prepared statement that has to be executed
462
     *
463
     * @return void
464
     */
465
    abstract protected function deleteDecimalAttribute(array $row, $name = null);
466
467
    /**
468
     * Delete's the integer attribute with the passed value ID.
469
     *
470
     * @param array       $row  The attributes of the entity to delete
471
     * @param string|null $name The name of the prepared statement that has to be executed
472
     *
473
     * @return void
474
     */
475
    abstract protected function deleteIntAttribute(array $row, $name = null);
476
477
    /**
478
     * Delete's the text attribute with the passed value ID.
479
     *
480
     * @param array       $row  The attributes of the entity to delete
481
     * @param string|null $name The name of the prepared statement that has to be executed
482
     *
483
     * @return void
484
     */
485
    abstract protected function deleteTextAttribute(array $row, $name = null);
486
487
    /**
488
     * Delete's the varchar attribute with the passed value ID.
489
     *
490
     * @param array       $row  The attributes of the entity to delete
491
     * @param string|null $name The name of the prepared statement that has to be executed
492
     *
493
     * @return void
494
     */
495
    abstract protected function deleteVarcharAttribute(array $row, $name = null);
496
}
497