Я пытаюсь расширить Shopware v5.4.6 \ Shopware \ Components \ Api \ Resource \ CustomerGroup, добавив к нему атрибуты, но он не отображается в ответе API.
Я попытался изменить назначение расширения примера ресурса Customer API, но это не сработало.
"SwagExtendCustomerGroupResource \ Components \ Api \ Resource \ CustomerGroup.php"
class CustomerGroup extends \Shopware\Components\Api\Resource\CustomerGroup
{
/**
* @inheritdoc
*/
public function getOne($id)
{
$result = parent::getOne($id);
$result ['attribute'] = $result->getAttribute();
return $result;
}
}
"SwagExtendCustomerGroupResource \ Resources \ services.xml"
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="swag_extend_customer_group_resource.customer_group_resource"
class="SwagExtendCustomerGroupResource\Components\Api\Resource\CustomerGroup"
decorates="shopware.api.customergroup"
public="false"
shared="false">
</service>
</services>
</container>
Я ожидал увидеть свойство "attribute", но оно не отображается