// set data to model and overwrite the image field
$supplierModel->
fromArray($params);
$supplierModel->
setChanged();
$mediaData =
$this->
Request()->
get('media-manager-selection'
);
if (!
empty($mediaData)) { $supplierModel->
setImage($this->
Request()->
get('media-manager-selection'
));
} // strip full qualified url
$mediaService =
$this->
get(MediaServiceInterface::
class);
$supplierModel->
setImage($mediaService->
normalize($supplierModel->
getImage()));
// backend checks
$name =
$supplierModel->
getName();
if (empty($name)) { $this->
View()->
assign([ 'success' => false,
'errorMsg' => 'No supplier name given',
]);
return;
}