Zend certified PHP/Magento developer

REST API – using not extanceable model

I’m trying to add ‘getter’ and ‘setter’ for my custom option value attribute, but ‘MagentoCatalogModelProductOptionValue’ is not extanceable model. I overrided the following method ‘MagentoCatalogModelProductOptionValue’:

namespace VendorModuleNameModelProductOption;

use VendorModuleNameModelOptionTypeTitle;


/**
 * Catalog product option select type model
 *
 * @api
 */
class Value extends MagentoCatalogModelProductOptionValue
{

    /**
     * {@inheritdoc}
     */
    public function getCustomTitle()
    {
        return $this->_getData(OptionTypeTitle::KEY_OPTION_TYPE_TITLE);
    }

    /**
     * {@inheritdoc}
     */
    public function setCustomTitle($customTitle)
    {
        $this->setData(OptionTypeTitle::KEY_OPTION_TYPE_TITLE, $customTitle);
        return $this;
    }
}

Also, I added Interface, extended from ‘MagentoCatalogApiDataProductCustomOptionValuesInterface’ :

namespace VendorModuleNameApiData;

/**
 * @api
 */
interface ProductCustomOptionValuesInterface extends MagentoCatalogApiDataProductCustomOptionValuesInterface
{

    /**
     * @return string|null
     */
    public function getCustomTitle();

    /**
     * @param string $customTitle
     * @return $this
     */
    public function setCustomTitle($customTitle);
}

When I used ‘/V1/products/abc/options’ rest call (abs – product SKU), I got the following respone:

[
    {
        "product_sku": "abs",
        "option_id": 1296,
        "title": "test 11",
        "type": "drop_down",
        "sort_order": 1,
        "is_require": true,
        "max_characters": 0,
        "image_size_x": 0,
        "image_size_y": 0,
        "values": [
            {
                "title": "test1",
                "sort_order": 1,
                "price": 100,
                "price_type": "fixed",
                "option_type_id": 6204
            }
     }
]

If I change getValues()PHPDoc:

/**
 * @return MagentoCatalogApiDataProductCustomOptionValuesInterface[]|null
 */
 public function getValues();

to

/**
 * @return VendorModuleNameApiDataProductCustomOptionValuesInterface[]|null
 */
 public function getValues();

in core magento interface (MagentoCatalogApiDataProductCustomOptionInterface), rest call works properly.

P.S. Also I tried to overrided MagentoCatalogApiDataProductCustomOptionInterface->getValues() and MagentoCatalogModel/Product/Option->getValues(), but It did not help me.