From 578884de75ddf2a814c60c773afadecabe83c328 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolas=20B=C3=A9jean?= <nicolas@bejean.eu>
Date: Sat, 9 May 2020 16:14:26 +0200
Subject: [PATCH] =?UTF-8?q?Modification=20des=20alias=20des=20requ=C3=AAte?=
 =?UTF-8?q?s=20SQL?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Model/ResourceModel/CategoryWidget.php | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/Model/ResourceModel/CategoryWidget.php b/Model/ResourceModel/CategoryWidget.php
index 3ef608c..0a59c5a 100755
--- a/Model/ResourceModel/CategoryWidget.php
+++ b/Model/ResourceModel/CategoryWidget.php
@@ -166,12 +166,12 @@ class CategoryWidget extends AbstractDb
             $stores = [(int)$object->getStoreId(), Store::DEFAULT_STORE_ID];
 
             $select->join(
-                ['niis' => $this->getTable('nicolasbejean_categorywidget_store')],
-                $this->getMainTable() . '.' . $linkField . ' = niis.' . $linkField,
+                ['ncws' => $this->getTable('nicolasbejean_categorywidget_store')],
+                $this->getMainTable() . '.' . $linkField . ' = ncws.' . $linkField,
                 ['store_id']
             )
                 ->where('is_active = ?', 1)
-                ->where('niis.store_id in (?)', $stores)
+                ->where('ncws.store_id in (?)', $stores)
                 ->order('store_id DESC')
                 ->limit(1);
         }
@@ -200,17 +200,17 @@ class CategoryWidget extends AbstractDb
         }
 
         $select = $this->getConnection()->select()
-            ->from(['nii' => $this->getMainTable()])
+            ->from(['ncw' => $this->getMainTable()])
             ->join(
-                ['niis' => $this->getTable('nicolasbejean_categorywidget_store')],
-                'nii.' . $linkField . ' = niis.' . $linkField,
+                ['ncws' => $this->getTable('nicolasbejean_categorywidget_store')],
+                'ncw.' . $linkField . ' = ncws.' . $linkField,
                 []
             )
-            ->where('nii.identifier = ?', $object->getData('identifier'))
-            ->where('niis.store_id IN (?)', $stores);
+            ->where('ncw.identifier = ?', $object->getData('identifier'))
+            ->where('ncws.store_id IN (?)', $stores);
 
         if ($object->getId()) {
-            $select->where('nii.' . $entityMetadata->getIdentifierField() . ' <> ?', $object->getId());
+            $select->where('ncw.' . $entityMetadata->getIdentifierField() . ' <> ?', $object->getId());
         }
 
         if ($this->getConnection()->fetchRow($select)) {
@@ -236,13 +236,13 @@ class CategoryWidget extends AbstractDb
         $linkField = $entityMetadata->getLinkField();
 
         $select = $connection->select()
-            ->from(['niis' => $this->getTable('nicolasbejean_categorywidget_store')], 'store_id')
+            ->from(['ncws' => $this->getTable('nicolasbejean_categorywidget_store')], 'store_id')
             ->join(
-                ['nii' => $this->getMainTable()],
-                'niis.' . $linkField . ' = nii.' . $linkField,
+                ['ncw' => $this->getMainTable()],
+                'ncws.' . $linkField . ' = ncw.' . $linkField,
                 []
             )
-            ->where('nii.' . $entityMetadata->getIdentifierField() . ' = :entity_id');
+            ->where('ncw.' . $entityMetadata->getIdentifierField() . ' = :entity_id');
 
         return $connection->fetchCol($select, ['entity_id' => (int)$id]);
     }
-- 
GitLab