10

There are new things we can see at Magento 2.3 in di.xml for service contracts.

let's give an example:Magento_Cms module

Like

  • Magento\Framework\EntityManager\MetadataPool

  • Magento\Framework\EntityManager\HydratorPool

  • Magento\Framework\EntityManager\Operation\ExtensionPool

I've seen in those classes, data interface or Repository interface as added arguments.

Suppose:

For Magento\Framework\EntityManager\MetadataPool's metadata, Magento add Magento\Cms\Api\Data\PageInterface as a parameter and also added entity table name and table primary key.

    <type name="Magento\Framework\EntityManager\MetadataPool">
        <arguments>
            <argument name="metadata" xsi:type="array">
                <item name="Magento\Cms\Api\Data\PageInterface" xsi:type="array">
                    <item name="entityTableName" xsi:type="string">cms_page</item>
                    <item name="identifierField" xsi:type="string">page_id</item>
                </item>
                <item name="Magento\Cms\Api\Data\BlockInterface" xsi:type="array">
                    <item name="entityTableName" xsi:type="string">cms_block</item>
                    <item name="identifierField" xsi:type="string">block_id</item>
                </item>
            </argument>
        </arguments>
    </type>

  • Now, My question is what is Magento\Framework\EntityManager\MetadataPool and why it's needed.

  • Why add Data interface, database table name and it pk field as this class parameters.

  • If We build a custom module(Has Database table) which has server Contract, then we need to follow this process like Cms page

Same Questions, I have for Magento\Framework\EntityManager\HydratorPool

  <type name="Magento\Framework\EntityManager\HydratorPool">
        <arguments>
            <argument name="hydrators" xsi:type="array">
                <item name="Magento\Cms\Api\Data\PageInterface" xsi:type="string">Magento\Framework\EntityManager\AbstractModelHydrator</item>
                <item name="Magento\Cms\Api\Data\BlockInterface" xsi:type="string">Magento\Framework\EntityManager\AbstractModelHydrator</item>
            </argument>
        </arguments>
    </type>
1

1 Answer 1

1

See this article I hope it will help you : https://black.bird.eu/en/blog/recettem2-3.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.