Been reading the doc from Magento and i have been using extension attributes for more complex data structures but i’m basically wanting to add a simple scalar attribute
<extension_attributes for="MagentoSalesApiDataShipmentTrackInterface">
<attribute code="track_url" type="string"/>
</extension_attributes>
And i thought for scalar attributes, i pretty much don’t need to do anything else such as adding plugins, just need to set the value correctly and use repository to save
$shipment = $this->shipmentRepository->get($shipmentId);
$track = $this->trackFactory->create()
->setTrackNumber('123')
->setCarrierCode('abc')
->setTitle('super delivery');
$extensionAttributes = $track->getExtensionAttributes()->setTrackUrl(
'http://www.trackme.com/abcdef'
);
$track->setExtensionAttributes($extensionAttributes);
$shipment->addTrack($track);
$this->shipmentRepository->save($shipment);
Codes are generated correctly, no errors, but when i try to retrieve it, it doesn’t actually return anything
$track->getExtensionAttributes()->getTrackUrl()
Am i misunderstanding extension attributes then? Does it mean i will always need to add something new to the database, even for scalar types?