Skip to content

Commit 6c20141

Browse files
committed
Merge remote-tracking branch 'tango/MC-18696' into PR-08-233
2 parents 2fd918b + 0a429fa commit 6c20141

File tree

6 files changed

+149
-272
lines changed

6 files changed

+149
-272
lines changed

app/code/Magento/Rule/Model/ResourceModel/Rule/Collection/AbstractCollection.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/**
1010
* Abstract Rule entity resource collection model
1111
*
12+
* phpcs:disable Magento2.Classes.AbstractApi
1213
* @api
1314
* @since 100.0.2
1415
*/
@@ -83,11 +84,21 @@ public function addWebsiteFilter($websiteId)
8384
if ($website instanceof \Magento\Store\Model\Website) {
8485
$websiteIds[$index] = $website->getId();
8586
}
87+
$websiteIds[$index] = (int) $websiteIds[$index];
8688
}
89+
90+
$websiteSelect = $this->getConnection()->select();
91+
$websiteSelect->from(
92+
$this->getTable($entityInfo['associations_table']),
93+
[$entityInfo['rule_id_field']]
94+
)->distinct(
95+
true
96+
)->where(
97+
$this->getConnection()->quoteInto($entityInfo['entity_id_field'] . ' IN (?)', $websiteIds)
98+
);
8799
$this->getSelect()->join(
88-
['website' => $this->getTable($entityInfo['associations_table'])],
89-
$this->getConnection()->quoteInto('website.' . $entityInfo['entity_id_field'] . ' IN (?)', $websiteIds)
90-
. ' AND main_table.' . $entityInfo['rule_id_field'] . ' = website.' . $entityInfo['rule_id_field'],
100+
['website' => $websiteSelect],
101+
'main_table.' . $entityInfo['rule_id_field'] . ' = website.' . $entityInfo['rule_id_field'],
91102
[]
92103
);
93104
}
@@ -127,11 +138,11 @@ public function addIsActiveFilter($isActive = 1)
127138
}
128139

129140
/**
130-
* Retrieve correspondent entity information (associations table name, columns names)
131-
* of rule's associated entity by specified entity type
141+
* Retrieve correspondent entity information of rule's associated entity by specified entity type
132142
*
133-
* @param string $entityType
143+
* (associations table name, columns names)
134144
*
145+
* @param string $entityType
135146
* @throws \Magento\Framework\Exception\LocalizedException
136147
* @return array
137148
*/

app/code/Magento/Rule/Test/Unit/Model/ResourceModel/Rule/Collection/AbstractCollectionTest.php

Lines changed: 0 additions & 200 deletions
This file was deleted.

0 commit comments

Comments
 (0)