Skip to content

Commit a75fb60

Browse files
committed
ACPT-1408: Investigate 1m call on 1k rules
1 parent 4ffcb02 commit a75fb60

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
namespace Magento\SalesRule\Model\ResourceModel\Rule;
88

99
use Magento\Framework\DB\Select;
10+
use Magento\Framework\EntityManager\MetadataPool;
1011
use Magento\Framework\Model\AbstractExtensibleModel;
1112
use Magento\Framework\Serialize\Serializer\Json;
1213
use Magento\Quote\Model\Quote\Address;
1314
use Magento\SalesRule\Api\Data\CouponInterface;
15+
use Magento\SalesRule\Api\Data\RuleInterface;
16+
use Magento\SalesRule\Api\Data\RuleInterfaceFactory;
1417
use Magento\SalesRule\Model\Coupon;
1518
use Magento\SalesRule\Model\Rule;
1619

@@ -60,6 +63,11 @@ class Collection extends \Magento\Rule\Model\ResourceModel\Rule\Collection\Abstr
6063
*/
6164
private $serializer;
6265

66+
/**
67+
* @var MetadataPool $metadataPool
68+
*/
69+
private $metadataPool;
70+
6371
/**
6472
* @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
6573
* @param \Psr\Log\LoggerInterface $logger
@@ -78,13 +86,14 @@ public function __construct(
7886
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $date,
7987
\Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
8088
\Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null,
81-
Json $serializer = null
89+
Json $serializer = null,
90+
MetadataPool $metadataPool = null,
8291
) {
8392
parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource);
8493
$this->_date = $date;
8594
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()->get(Json::class);
8695
$this->_associatedEntitiesMap = $this->getAssociatedEntitiesMap();
87-
$this->_setIdFieldName('row_id');
96+
$this->_setIdFieldName($this->metadataPool->getMetadata(RuleInterface::class)->getLinkField());
8897
}
8998

9099
/**

0 commit comments

Comments
 (0)