Skip to content

Commit 94b07e0

Browse files
author
Dmitry Kologrivov
committed
MAGNIMEX-156: Fix phpcs and getTable from resource
1 parent d849fef commit 94b07e0

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

app/code/Magento/AdvancedPricingImportExport/Model/Export/AdvancedPricing.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ class AdvancedPricing extends \Magento\CatalogImportExport\Model\Export\Product
3737
*/
3838
protected $_entityTypeCode;
3939

40+
/**
41+
* @var
42+
*/
43+
protected $_resource;
44+
4045
/**
4146
* @var int
4247
*/
@@ -122,6 +127,7 @@ public function __construct(
122127
) {
123128
$this->_storeResolver = $storeResolver;
124129
$this->_groupRepository = $groupRepository;
130+
$this->_resource = $resource;
125131
parent::__construct(
126132
$localeDate,
127133
$config,
@@ -364,37 +370,37 @@ protected function getTierAndGroupPrices(array $listSku, $table)
364370
if ($listSku) {
365371
if (isset($exportFilter) && !empty($exportFilter)) {
366372
$date = $exportFilter[\Magento\Catalog\Model\Category::KEY_UPDATED_AT];
367-
if ($date[0]) {
368-
$updatedAtFrom = date( 'Y-m-d H:i:s', strtotime($date[0]));
373+
if (isset($date[0]) && !empty($date[0])) {
374+
$updatedAtFrom = date('Y-m-d H:i:s', strtotime($date[0]));
369375
}
370-
if ($date[1]) {
371-
$updatedAtTo = date( 'Y-m-d H:i:s', strtotime($date[1]));
376+
if (isset($date[1]) && !empty($date[1])) {
377+
$updatedAtTo = date('Y-m-d H:i:s', strtotime($date[1]));
372378
}
373379
}
374380
try {
375381
$select = $this->_connection->select()
376382
->from(
377-
['cpe' => $this->_connection->getTableName('catalog_product_entity')],
383+
['cpe' => $this->_resource->getTableName('catalog_product_entity')],
378384
$selectFields
379385
)
380386
->joinInner(
381-
['ap' => $this->_connection->getTableName($table)],
387+
['ap' => $this->_resource->getTableName($table)],
382388
'ap.entity_id = cpe.entity_id',
383389
[]
384390
)
385391
->where('cpe.entity_id IN (?)', $listSku);
386392

387393
if (isset($price[0]) && !empty($price[0])) {
388-
$select->where('ap.value >=? ', $price[0]);
394+
$select->where('ap.value >= ?', $price[0]);
389395
}
390396
if (isset($price[1]) && !empty($price[1])) {
391-
$select->where('ap.value <=? ', $price[1]);
397+
$select->where('ap.value <= ?', $price[1]);
392398
}
393399
if (isset($updatedAtFrom) && !empty($updatedAtFrom)) {
394400
$select->where('cpe.updated_at >= ?', $updatedAtFrom);
395401
}
396402
if (isset($updatedAtTo) && !empty($updatedAtTo)) {
397-
$select->where('cpe.updated_at <=? ', $updatedAtTo);
403+
$select->where('cpe.updated_at <= ?', $updatedAtTo);
398404
}
399405
$exportData = $this->_connection->fetchAll($select);
400406
} catch (\Exception $e) {

0 commit comments

Comments
 (0)