From c3600021a1c230d774349326b5a78ab83f3176ca Mon Sep 17 00:00:00 2001 From: Oleksandr Kravchuk Date: Sat, 13 Nov 2021 15:02:58 +0200 Subject: [PATCH] run-as-root/magento2-prometheus-exporter#24: - Fix code styles. --- .../Category/CategoryCountAggregator.php | 35 +++++++++---------- .../Shipment/ShipmentCountAggregator.php | 23 ++++++------ 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/src/Aggregator/Category/CategoryCountAggregator.php b/src/Aggregator/Category/CategoryCountAggregator.php index d353c77..81ead54 100644 --- a/src/Aggregator/Category/CategoryCountAggregator.php +++ b/src/Aggregator/Category/CategoryCountAggregator.php @@ -142,24 +142,23 @@ private function getSelect(AdapterInterface $connection): Select )->joinInner( ['cce2' => $connection->getTableName('catalog_category_entity')], "cce2.path like CONCAT(cce1.path, '%')" - )->joinLeft( - ['ccei1' => $connection->getTableName('catalog_category_entity_int')], - "cce2.$linkField = ccei1.$linkField AND " . - "ccei1.attribute_id = $isActive AND ccei1.store_id = s.store_id" - )->joinLeft( - ['ccei2' => $connection->getTableName('catalog_category_entity_int')], - "cce2.$linkField = ccei2.$linkField AND " . - "ccei2.attribute_id = $isActive AND ccei2.store_id = 0" - )->joinLeft( - ['ccei3' => $connection->getTableName('catalog_category_entity_int')], - "cce2.$linkField = ccei3.$linkField AND " . - "ccei3.attribute_id = $isInMenu AND ccei3.store_id = s.store_id" - )->joinLeft( - ['ccei4' => $connection->getTableName('catalog_category_entity_int')], - "cce2.$linkField = ccei4.$linkField AND " . - "ccei4.attribute_id = $isInMenu AND ccei4.store_id = 0" - )->reset(Select::COLUMNS) - ->columns( + )->joinLeft( + ['ccei1' => $connection->getTableName('catalog_category_entity_int')], + "cce2.$linkField = ccei1.$linkField AND " . + "ccei1.attribute_id = $isActive AND ccei1.store_id = s.store_id" + )->joinLeft( + ['ccei2' => $connection->getTableName('catalog_category_entity_int')], + "cce2.$linkField = ccei2.$linkField AND " . + "ccei2.attribute_id = $isActive AND ccei2.store_id = 0" + )->joinLeft( + ['ccei3' => $connection->getTableName('catalog_category_entity_int')], + "cce2.$linkField = ccei3.$linkField AND " . + "ccei3.attribute_id = $isInMenu AND ccei3.store_id = s.store_id" + )->joinLeft( + ['ccei4' => $connection->getTableName('catalog_category_entity_int')], + "cce2.$linkField = ccei4.$linkField AND " . + "ccei4.attribute_id = $isInMenu AND ccei4.store_id = 0" + )->reset(Select::COLUMNS)->columns( [ 'STORE_CODE' => 's.code', 'ACTIVE_IN_MENU' => $activeInMenu, diff --git a/src/Aggregator/Shipment/ShipmentCountAggregator.php b/src/Aggregator/Shipment/ShipmentCountAggregator.php index 487251b..2a5f7fa 100644 --- a/src/Aggregator/Shipment/ShipmentCountAggregator.php +++ b/src/Aggregator/Shipment/ShipmentCountAggregator.php @@ -22,7 +22,7 @@ class ShipmentCountAggregator implements MetricAggregatorInterface */ public function __construct( UpdateMetricService $updateMetricService, - ResourceConnection $resourceConnection + ResourceConnection $resourceConnection ) { $this->updateMetricService = $updateMetricService; $this->resourceConnection = $resourceConnection; @@ -72,17 +72,16 @@ private function getSelect(AdapterInterface $connection): Select 'ss.entity_id = iss.shipment_id', ['source_code'] )->joinInner( - ['s' => $connection->getTableName('store')], - 'ss.store_id = s.store_id', - ['code'] - )->reset(Select::COLUMNS) - ->columns( - [ - 'SHIPMENT_COUNT' => 'COUNT(ss.entity_id)', - 'STORE_CODE' => 's.code', - 'SOURCE_CODE' => 'iss.source_code' - ] - )->group(['s.code', 'iss.source_code']); + ['s' => $connection->getTableName('store')], + 'ss.store_id = s.store_id', + ['code'] + )->reset(Select::COLUMNS)->columns( + [ + 'SHIPMENT_COUNT' => 'COUNT(ss.entity_id)', + 'STORE_CODE' => 's.code', + 'SOURCE_CODE' => 'iss.source_code' + ] + )->group(['s.code', 'iss.source_code']); return $select; }