diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 13977ae..d7a4643 100644 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -103,16 +103,16 @@ final class ApiController extends Controller $this->createLocalFile($fullPath, (string) $request->getData('image')); $status = [ - 'path' => $path, - 'filename' => $filename, - 'name' => (string) $request->getData('title'), - 'size' => File::size($fullPath), + 'path' => $path, + 'filename' => $filename, + 'name' => (string) $request->getData('title'), + 'size' => File::size($fullPath), 'extension' => $extension, - 'status' => UploadStatus::OK, + 'status' => UploadStatus::OK, ]; $media = MediaController::createDbEntry($status, $request->getHeader()->getAccount()); - $draw = DrawImage::fromMedia($media); + $draw = $media !== null ? DrawImage::fromMedia($media) : null; $this->createModel($request->getHeader()->getAccount(), $draw, DrawImageMapper::class, 'draw'); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Draw', 'Draw successfully created.', $draw); diff --git a/Models/DrawImageMapper.php b/Models/DrawImageMapper.php index 5c7f10c..d78bf8d 100644 --- a/Models/DrawImageMapper.php +++ b/Models/DrawImageMapper.php @@ -41,7 +41,7 @@ final class DrawImageMapper extends DataMapperAbstract /** * Has one relation. * - * @var array + * @var array * @since 1.0.0 */ protected static array $ownsOne = [