![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-sales-rule/Model/ResourceModel/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\SalesRule\Model\ResourceModel; use Magento\Framework\EntityManager\MetadataPool; use Magento\Framework\EntityManager\Operation\AttributeInterface; /** * Class ReadHandler */ class ReadHandler implements AttributeInterface { /** * @var Rule */ protected $ruleResource; /** * @var MetadataPool */ protected $metadataPool; /** * @param Rule $ruleResource * @param MetadataPool $metadataPool */ public function __construct( Rule $ruleResource, MetadataPool $metadataPool ) { $this->ruleResource = $ruleResource; $this->metadataPool = $metadataPool; } /** * Read handler * * @param string $entityType * @param array $entityData * @param array $arguments * @return array * @throws \Exception * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function execute($entityType, $entityData, $arguments = []) { $linkField = $this->metadataPool->getMetadata($entityType)->getLinkField(); $entityId = $entityData[$linkField]; $entityData['customer_group_ids'] = $this->ruleResource->getCustomerGroupIds($entityId); $entityData['website_ids'] = $this->ruleResource->getWebsiteIds($entityId); return $entityData; } }