i have made custom column called coord
in customer_address_entity
using db_schema.xml
<!-- add coordinate to customer address entity -->
<table name="customer_address_entity" resource="default" engine="innodb" comment="Customer Address Entity">
<column xsi:type="text" name="coord" nullable="true" comment="Coordinate"/>
</table>
to save the data i make an observer but the data won’t save to my new column coord, while if i try to save it to vat_request_date, it works
public function execute(Observer $observer)
{
$address = $observer->getCustomerAddress();
$coordinate = $this->_request->getParam('coordinate', '');
$writer = new ZendLogWriterStream(BP . '/var/log/debug.log');
$logger = new ZendLogLogger();
$logger->addWriter($writer);
$logger->info('Coordinate: ' . $coordinate);
if ($coordinate) {
$address->setCoord($coordinate);
$address->setVatRequestDate($coordinate);
$logger->info('Data : ' . print_r($address->getData(), true));
}
}
it successfully writes the value of coordinate on the log file
[coord] => -6.198619001508404,106.81663381349182
[vat_request_date] => -6.198619001508404,106.81663381349182
this is the events.xml
<event name="customer_address_save_before">
<observer name="lime_courier_set_latlong" instance="LimeCourierObserverSaveLatlongAddressSaveObserver" />
</event>