Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Commit ee44c23

Browse files
authored
Merge pull request #63 from bakaphp/filesystem-add-get-files-functions
Filesystem add get files functions
2 parents 5bbecc0 + af8c22c commit ee44c23

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/SystemModules.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static function validateOrCreate(string $modelName, int $appsId) : object
5959
'slug' => $classSlug,
6060
'model_name' => $modelName,
6161
'browse_fields' => '[]',
62-
'show' => 0,
62+
'show' => 1,
6363
'protected' => 0,
6464
'created_at' => date('Y-m-d H:m:s'),
6565
'is_deleted' => 0

src/Traits/FileSystemModelTrait.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public function deleteFiles() : bool
182182
*
183183
* @return KanvasObject
184184
*/
185-
public function getFiles() : KanvasObject
185+
public function getFiles() : array
186186
{
187187
$appsId = Apps::getIdByKey(getenv('GEWAER_APP_ID'));
188188
$systemModule = SystemModules::validateOrCreate(self::class, (int)$appsId);
@@ -202,6 +202,7 @@ public function getFileByName(string $fieldName) : ?object
202202
{
203203
$appsId = Apps::getIdByKey(getenv('GEWAER_APP_ID'));
204204
$systemModule = SystemModules::validateOrCreate(self::class, (int)$appsId);
205-
return FileSystemEntities::find(['conditions' => ["entity_id:{$this->id}", "system_modules_id:{$systemModule->id}", "field_name:{$fieldName}", 'is_deleted:0']]);
205+
$fileSystemEntities = FileSystemEntities::find(['conditions' => ["entity_id:{$this->id}", "system_modules_id:{$systemModule->id}", "field_name:{$fieldName}", 'is_deleted:0']]);
206+
return is_object($fileSystemEntities) ? $fileSystemEntities : null;
206207
}
207208
}

0 commit comments

Comments
 (0)