I added custom column 'email_status' in customer_entity table via dc_schema.xml
<?xml version="1.0"?>
<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="tinyint" name="email_status" default="0" unsigned="true" nullable="false"
comment="1 = pending | 2 = sent"/>
</table>
</schema>
bin/magento setup:db-declaration:generate-whitelist
bin/magento setup:upgrade command.
The field added successfully. But when I am trying to modify it via customer model, It is not modifying. Here is the code.
$customer = $this->customer->load(2);
$customer->setData('email_status', 1);
try {
$customer->save();
} catch (\Exception $e) {
echo $e->getMessage();
}
Please help me.