di.xml 8.97 KB
<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\SalesRule\Api\RuleRepositoryInterface"
                type="Magento\SalesRule\Model\RuleRepository" />
    <preference for="Magento\SalesRule\Api\Data\RuleInterface"
                type="Magento\SalesRule\Model\Data\Rule" />
    <preference for="Magento\SalesRule\Api\Data\ConditionInterface"
                type="Magento\SalesRule\Model\Data\Condition" />
    <preference for="Magento\SalesRule\Api\Data\RuleSearchResultInterface"
                type="Magento\Framework\Api\SearchResults" />
    <preference for="Magento\SalesRule\Api\Data\RuleLabelInterface"
                type="Magento\SalesRule\Model\Data\RuleLabel" />
    <preference for="Magento\SalesRule\Api\Data\CouponInterface"
                type="Magento\SalesRule\Model\Coupon" />
    <preference for="Magento\SalesRule\Api\CouponRepositoryInterface"
                type="Magento\SalesRule\Model\CouponRepository" />
    <preference for="Magento\SalesRule\Model\Spi\CouponResourceInterface"
                type="Magento\SalesRule\Model\ResourceModel\Coupon" />
    <preference for="Magento\SalesRule\Api\Data\CouponSearchResultInterface"
                type="Magento\Framework\Api\SearchResults" />
    <preference for="Magento\SalesRule\Api\Data\CouponGenerationSpecInterface"
                type="Magento\SalesRule\Model\Data\CouponGenerationSpec" />
    <preference for="Magento\SalesRule\Api\Data\CouponMassDeleteResultInterface"
                type="Magento\SalesRule\Model\Data\CouponMassDeleteResult" />
    <preference for="Magento\SalesRule\Api\CouponManagementInterface"
                type="Magento\SalesRule\Model\Service\CouponManagementService" />
    <type name="Magento\SalesRule\Helper\Coupon">
        <arguments>
            <argument name="couponParameters" xsi:type="array">
                <item name="separator" xsi:type="string">-</item>
                <item name="charset" xsi:type="array">
                    <item name="alphanum" xsi:type="string">ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789</item>
                    <item name="alpha" xsi:type="string">ABCDEFGHIJKLMNOPQRSTUVWXYZ</item>
                    <item name="num" xsi:type="string">0123456789</item>
                </item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\SalesRule\Model\ResourceModel\Rule\Collection" shared="false" />
    <type name="Magento\Quote\Model\Quote\Config">
        <plugin name="append_sales_rule_keys_to_quote" type="Magento\SalesRule\Model\Plugin\QuoteConfigProductAttributes"/>
    </type>
    <type name="Magento\Framework\Module\Setup\Migration">
        <arguments>
            <argument name="compositeModules" xsi:type="array">
                <item name="salesrule" xsi:type="string">Magento_SalesRule</item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\Framework\App\Rss\RssManagerInterface">
        <arguments>
            <argument name="dataProviders" xsi:type="array">
                <item name="discounts" xsi:type="string">Magento\SalesRule\Block\Rss\Discounts</item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\SalesRule\Model\ResourceModel\Report\Rule">
        <arguments>
            <argument name="connectionName" xsi:type="string">sales</argument>
        </arguments>
    </type>
    <type name="Magento\SalesRule\Model\ResourceModel\Report\Rule\Createdat">
        <arguments>
            <argument name="connectionName" xsi:type="string">sales</argument>
        </arguments>
    </type>
    <type name="Magento\SalesRule\Model\ResourceModel\Report\Rule\Updatedat">
        <arguments>
            <argument name="connectionName" xsi:type="string">sales</argument>
        </arguments>
    </type>
    <type name="Magento\Framework\Model\Entity\RepositoryFactory">
        <arguments>
            <argument name="entities" xsi:type="array">
                <item name="Magento\SalesRule\Api\Data\RuleInterface" xsi:type="string">Magento\SalesRule\Model\ResourceModel\Rule</item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\Framework\EntityManager\MetadataPool">
        <arguments>
            <argument name="metadata" xsi:type="array">
                <item name="Magento\SalesRule\Api\Data\RuleInterface" xsi:type="array">
                    <item name="entityTableName" xsi:type="string">salesrule</item>
                    <item name="identifierField" xsi:type="string">rule_id</item>
                </item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\Framework\EntityManager\Operation\AttributePool">
        <arguments>
            <argument name="extensionActions" xsi:type="array">
                <item name="salesRule" xsi:type="array">
                    <item name="Magento\SalesRule\Api\Data\RuleInterface" xsi:type="array">
                        <item name="read" xsi:type="string">Magento\SalesRule\Model\ResourceModel\ReadHandler</item>
                        <item name="create" xsi:type="string">Magento\SalesRule\Model\ResourceModel\SaveHandler</item>
                        <item name="update" xsi:type="string">Magento\SalesRule\Model\ResourceModel\SaveHandler</item>
                    </item>
                </item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\SalesRule\Model\Rule\Condition\Address">
        <arguments>
            <argument name="data" xsi:type="array">
                <item name="form_name" xsi:type="string">sales_rule_form</item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\SalesRule\Model\Rule\Condition\Combine">
        <arguments>
            <argument name="data" xsi:type="array">
                <item name="form_name" xsi:type="string">sales_rule_form</item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\SalesRule\Model\Rule\Condition\Product">
        <arguments>
            <argument name="data" xsi:type="array">
                <item name="form_name" xsi:type="string">sales_rule_form</item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\SalesRule\Model\Rule\Condition\Product\Combine">
        <arguments>
            <argument name="data" xsi:type="array">
                <item name="form_name" xsi:type="string">sales_rule_form</item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\SalesRule\Model\Rule\Condition\Product\Found">
        <arguments>
            <argument name="data" xsi:type="array">
                <item name="form_name" xsi:type="string">sales_rule_form</item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\SalesRule\Model\Rule\Condition\Product\Subselect">
        <arguments>
            <argument name="data" xsi:type="array">
                <item name="form_name" xsi:type="string">sales_rule_form</item>
            </argument>
        </arguments>
    </type>
    <type name="Magento\SalesRule\Model\Rule\Customer">
        <arguments>
            <argument name="data" xsi:type="array">
                <item name="form_name" xsi:type="string">sales_rule_form</item>
            </argument>
        </arguments>
    </type>
    <virtualType name="Magento\SalesRule\Model\ResourceModel\Rule\AssociatedEntityMap" type="Magento\Framework\DataObject">
        <arguments>
            <argument name="data" xsi:type="array">
                <item name="website" xsi:type="array">
                    <item name="associations_table" xsi:type="string">salesrule_website</item>
                    <item name="rule_id_field" xsi:type="string">rule_id</item>
                    <item name="entity_id_field" xsi:type="string">website_id</item>
                </item>
                <item name="customer_group" xsi:type="array">
                    <item name="associations_table" xsi:type="string">salesrule_customer_group</item>
                    <item name="rule_id_field" xsi:type="string">rule_id</item>
                    <item name="entity_id_field" xsi:type="string">customer_group_id</item>
                </item>
            </argument>
        </arguments>
    </virtualType>
    <type name="Magento\Framework\EntityManager\HydratorPool">
        <arguments>
            <argument name="hydrators" xsi:type="array">
                <item name="Magento\SalesRule\Api\Data\RuleInterface" xsi:type="string">Magento\Framework\EntityManager\AbstractModelHydrator</item>
                <item name="Magento\SalesRule\Api\Data\CouponInterface" xsi:type="string">Magento\Framework\EntityManager\AbstractModelHydrator</item>
            </argument>
        </arguments>
    </type>

    <type name="Magento\Quote\Model\Cart\CartTotalRepository">
        <plugin name="coupon_label_plugin" type="Magento\SalesRule\Plugin\CartTotalRepository" />
    </type>
</config>