What is the code that generates the ExtensionInterface suffixed classes ?

For example, there is this file that declares extension attribute on the product options (and others). Magento/Catalog/etc/extension_attributes.xml.

Here is a sample if it.

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Quote\Api\Data\ProductOptionInterface">
        <attribute code="custom_options" type="Magento\Catalog\Api\Data\CustomOptionInterface[]" />

This declaration will add the methods getCustomOptions and getCustomOptions in the autogenrated interface Magento\Catalog\Api\Data\ProductOptionExtensionInterface and in the implementation of this class Magento\Catalog\Api\Data\ProductOptionExtension (both located in the generated/code folder).

My question is simple. What is the code that reads the extension_attributes.xml files and generates the interfaces and classes?

(PS. I don't want an explanation on how to add my own attributes).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.