I face problem with extension interface in website.
My extension_attributes.xml:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="Magento\SalesRule\Api\Data\CouponGenerationSpecInterface">
<attribute code="specific" type="string" />
</extension_attributes>
</config>
My di.xml
<preference for="Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Form"
type="Custom\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Form" />
<preference for="Magento\SalesRule\Helper\Coupon"
type="Custom\SalesRule\Helper\Coupon"/>
<preference for="Magento\SalesRule\Model\Service\CouponManagementService"
type="Custom\SalesRule\Model\Service\CouponManagementService"/>
<preference for="Magento\SalesRule\Model\Coupon\Massgenerator"
type="Custom\SalesRule\Model\Coupon\Massgenerator"/>
<preference for="Magento\SalesRule\Model\Data\CouponGenerationSpec"
type="Custom\SalesRule\Model\Data\CouponGenerationSpec"/>
My model/data:
<?php
namespace Custom\SalesRule\Model\Data;
class CouponGenerationSpec extends \Magento\SalesRule\Model\Data\CouponGenerationSpec
{
const KEY_SPECIFIC = 'specific';
public function getSpecific()
{
return $this->_get(self::KEY_SPECIFIC);
}
public function setSpecific($specific)
{
return $this->setData(self::KEY_SPECIFIC, $specific);
}
}
The $specific return null ever.
My CouponGenerationSpecExtensionInterface.php and CouponGenerationSpecExtension.php extended setSpecific y getSpecific but i never can enter in $specific.
$specific
always returnsnull
? in debugging do you see if$specific
is populated when you try to assign something to it ? because maybe it does and then without persistence it resets to null. developer.adobe.com/commerce/php/development/components/…