I have created new column in customer_entity table
class UpgradeData implements UpgradeDataInterface{
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
if (version_compare($context->getVersion(),'1.0.6'<0)){
$customerName = $setup->getTable('customer_entity');
if ($setup->getConnection()->isTableExists($customerName) == true) {
$connection = $setup->getConnection();
$connection->addColumn(
$customerName,
'family_name',
[
'type' => MagentoFrameworkDBDdlTable::TYPE_TEXT,
'length' => 100,
'nullable' => true,
'comment' => 'Family Name'
]
);
}
}
}
and i am creating a customer programmatically.
$customerFactory = $this->_objectManager->get('MagentoCustomerModelCustomerFactory');
$newCustomer = $customerFactory->create();
$newCustomer->setWebsiteId($this->_storeManager->getWebsite()->getId());
$newCustomer->setEmail('email@email.com');
$newCustomer->setFirstname('First name');
$newCustomer->setLastname('Last name');
$newCustomer->setPassword('Password');
.....
$newCustomer->setData('family_name', $externalUser['FamilyName']);
$newCustomer->save();
But only family_name (custom field) is not storing in customer_entity table.
Is this the proper way to store custom field ?
$newCustomer->setData('family_name', $externalUser['FamilyName']);
any idea?