I have a custom rest api for PUT and POST that the post data is an empty array therefore not saving as it's empty can anyone advise why or what could be wrong?
/**
* Save data.
*
* @param RetailerImageInterface $retailerImage
* @return RetailerImageInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function save(RetailerImageInterface $retailerImage)
{
/** @var RetailerImageInterface|\Magento\Framework\Model\AbstractModel $retailerImage */
try {
print_r($retailerImage->getData());
$this->resource->save($retailerImage);
} catch (\Exception $e) {
throw new CouldNotSaveException(__($e->getMessage()));
}
return $retailerImage;
}
If I do $this->request->getContent()
I can see post data but not through the repository save method.
Has anyone experience this It might be something silly that I'm missing but not sure what it is!
Thanks