Skip to content

Instantly share code, notes, and snippets.

@jalogut
Created March 18, 2018 13:01
Show Gist options
  • Save jalogut/747584d1598317e70c9c88adfa213dc6 to your computer and use it in GitHub Desktop.
Save jalogut/747584d1598317e70c9c88adfa213dc6 to your computer and use it in GitHub Desktop.
Fix eavSetup in Compiled mode
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<!-- We create our own virtual class because original Magento\Setup\Module\DataSetup cannot be instantiated when compilation enabled. -->
<virtualType name="Vendor\Module\Setup\Module\DataSetup" type="Magento\Setup\Module\DataSetup">
<arguments>
<argument name="context" xsi:type="object">Magento\Framework\Module\Setup\Context</argument>
</arguments>
</virtualType>
<virtualType name="Vendor\Module\Eav\Setup\EavSetup" type="Magento\Eav\Setup\EavSetup">
<arguments>
<argument name="setup" xsi:type="object">Vendor\Module\Setup\Module\DataSetup</argument>
</arguments>
</virtualType>
<type name="Vendor\Module\ClassWhereYouInjectEavSetup">
<arguments>
<argument name="eavSetup" xsi:type="object">Vendor\Module\Eav\Setup\EavSetup</argument>
</arguments>
</type>
</config>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment