cancel
Showing results for 
Search instead for 
Did you mean: 

Extension Attributes for CustomOptionInterface

Extension Attributes for CustomOptionInterface

Hi. I'm developing a module where I want to add a new entity called "course" and I want to create an "extension attribute" to allows to the customers to select a course on the moment they are adding products to his shopiing cart.

 

In my module, I have created an extensions_attributes.xml

<?xml version="1.0"?>
<config>
   <extension_attributes for="\Magento\Catalog\Api\Data\CustomOptionInterface">
      <attribute code="course" type="datatype">
         <resources>
            <resource ref="Magento_CatalogInventory::cataloginventory" />
         </resources>
         <join reference_table="ie_course" reference_field="course_id" join_on_field="entity_id">
            <field>name</field>
         </join> 
       </attribute>
    </extension_attributes>
</config>

 

 

After I cleared the var directory and regenerate the depencendy injections class I think I would see the methods getCourse and setCourse on a file called /var/generation/Magento/Catalog/CustomOptionInterface.php but this file doesn't exists

 

The most similar file is ProductOptionsExtensionInterface.php but I didn't find anything related with my new methods

 

Maybe I misunderstood some concepts of the Magento Documentation. These are the links I'm following

http://devdocs.magento.com/guides/v2.0/extension-dev-guide/attributes.html

http://magento.stackexchange.com/questions/91992/magento-2-how-to-save-custom-field-added-in-the-for...

 

Could you please point me on the right direction?

 

 

Thanks very much!