Pergunta

I added a custom attribute in de customer_entity table with db_schema.xml. I can get the value of that attribute with getdata('debtor_id') but I can't set it with setData('debtor_id' ,2).

Did I miss a step?

<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
 
    <table name="customer_entity">
        <column  xsi:type="int" name="debtor_id" padding="11" unsigned="false" nullable="true" identity="false"  comment="Debtor ID" />
    </table>
</schema>
Foi útil?

Solução

You have added a field inside customer_entity table, if you want to create a custom customer attribute you have to create a custom attribute by implementing Setup\Patch functions.

Refer this: SampleEavAttribute

Remove the column and do setup:upgrade. after that, check in the database whether that field is removed or not. if it's not removed then you have to remove it. later try to implement using the suggested way.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top