0

Version : Magento cloud commerce 2.3.2

In magento_customerbalance I've added new column date and I'm trying to save it in following way

/*Obj for testing purpose only */
$balance = $obj->get('\Magento\CustomerBalance\Model\BalanceFactory')->create();
$balance = $balance
        ->setCustomer($customer)
        ->setWebsiteId($customer->getWebsiteId())
        ->setAmountDelta('5293')
        ->setNotifyByEmail(false)
        ->setData('mydate','1388951999');
$balance->save();

It is saving the above details but it is not updating mydate column value.

It is saving mydate only 1st time, After that I'm not able to update it.

I want to update that date multiple times. So how do I do that?

0

Resolved it by following

$balance = $obj->get('\Magento\CustomerBalance\Model\BalanceFactory')->create();
$balance = $balance
        ->setCustomer($customer)
        ->setWebsiteId($customer->getWebsiteId())
        ->setAmountDelta('5293')
        ->setNotifyByEmail(false);
$balance = $balance->loadbyCustomer();
$balance->setData('mydate','1388951999');
$balance->save();
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.