Fixed uploading media in non-existing flex object (part 2)

This commit is contained in:
Matias Griese
2020-06-25 18:34:31 +03:00
parent b0a1effaf9
commit de151c8a9d
2 changed files with 8 additions and 0 deletions

View File

@@ -618,6 +618,10 @@ class FlexObject implements FlexObjectInterface, FlexAuthorizeInterface
$result = $storage->replaceRows([$storageKey => $this->prepareStorage()]);
if (method_exists($this, 'clearMediaCache')) {
$this->clearMediaCache();
}
$value = reset($result);
$meta = $value['__META'] ?? null;
if ($meta) {

View File

@@ -206,6 +206,10 @@ trait FlexMediaTrait
{
$updated = false;
foreach ($this->getUpdatedMedia() as $filename => $upload) {
if (is_array($upload)) {
// Uses new format with [UploadedFileInterface, array].
$upload = $upload[0];
}
if ($upload) {
$medium = MediumFactory::fromUploadedFile($upload);
if ($medium) {