From b170e66d360570036ca436802bedf678f5a2be80 Mon Sep 17 00:00:00 2001 From: anas-srikou Date: Tue, 12 Sep 2023 15:15:43 +0900 Subject: [PATCH] Check if data is generic binary type --- src/Resources/Table.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Resources/Table.php b/src/Resources/Table.php index 850a381..1ebcbd7 100644 --- a/src/Resources/Table.php +++ b/src/Resources/Table.php @@ -11,6 +11,7 @@ use DreamFactory\Core\Exceptions\InternalServerErrorException; use DreamFactory\Core\Exceptions\NotFoundException; use DreamFactory\Core\Exceptions\RestException; +use DreamFactory\Core\MongoDb\Enums\BinaryDataTypes; use DreamFactory\Core\MongoDb\Services\MongoDb; use DreamFactory\Core\Database\Resources\BaseNoSqlDbTableResource; use DreamFactory\Core\Utility\DataFormatter; @@ -679,10 +680,8 @@ protected static function fromMongoObjects($record) } $data = $data->toDateTime(); $data = ['$date' => $data->format($cfgFormat)]; - } elseif ($data instanceof Binary) { - if ($data->getType() == 0) { - $data = $data->getData(); - } + } elseif ($data instanceof Binary && $data->getType() === BinaryDataTypes::GENERIC) { + $data = $data->getData(); } } }