diff --git a/Admin/Install/db.json b/Admin/Install/db.json index 16d7466..853a0c8 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -14,6 +14,11 @@ "type": "VARCHAR(255)", "null": false }, + "media_type": { + "name": "media_type", + "type": "VARCHAR(255)", + "null": false + }, "media_description": { "name": "media_description", "type": "TEXT", diff --git a/Controller/Controller.php b/Controller/Controller.php index a5890e4..0b85166 100755 --- a/Controller/Controller.php +++ b/Controller/Controller.php @@ -27,6 +27,14 @@ use phpOMS\Module\WebInterface; */ class Controller extends ModuleAbstract implements WebInterface { + /** + * File path + * + * @var string + * @since 1.0.0 + */ + public const FILE_PATH = __DIR__ . '/../Files'; + /** * Module path. * diff --git a/Models/CollectionMapper.php b/Models/CollectionMapper.php index eb48ae5..63081f9 100755 --- a/Models/CollectionMapper.php +++ b/Models/CollectionMapper.php @@ -34,8 +34,8 @@ final class CollectionMapper extends MediaMapper 'sources' => [ 'mapper' => MediaMapper::class, 'table' => 'media_relation', - 'external' => 'media_relation_dst', - 'self' => 'media_relation_src', + 'external' => 'media_relation_src', + 'self' => 'media_relation_dst', ], ]; diff --git a/Models/Media.php b/Models/Media.php index 41ab657..e07ad7e 100755 --- a/Models/Media.php +++ b/Models/Media.php @@ -43,6 +43,14 @@ class Media implements \JsonSerializable */ protected string $name = ''; + /** + * Type. + * + * @var string + * @since 1.0.0 + */ + protected string $type = ''; + /** * Extension. * @@ -360,6 +368,16 @@ class Media implements \JsonSerializable return $this->name; } + /** + * @return string + * + * @since 1.0.0 + */ + public function getType() : string + { + return $this->type; + } + /** * @return string * @@ -460,6 +478,19 @@ class Media implements \JsonSerializable $this->name = $name; } + /** + * @param string $type Media type + * + * @return void + * + * @since 1.0.0 + */ + public function setType(string $type) : void + { + $this->type = $type; + } + + /** * @param string $description Media description * diff --git a/Models/MediaMapper.php b/Models/MediaMapper.php index d76d194..9027793 100755 --- a/Models/MediaMapper.php +++ b/Models/MediaMapper.php @@ -37,6 +37,7 @@ class MediaMapper extends DataMapperAbstract protected static array $columns = [ 'media_id' => ['name' => 'media_id', 'type' => 'int', 'internal' => 'id'], 'media_name' => ['name' => 'media_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true], + 'media_type' => ['name' => 'media_type', 'type' => 'string', 'internal' => 'type'], 'media_description' => ['name' => 'media_description', 'type' => 'string', 'internal' => 'description', 'autocomplete' => true], 'media_description_raw' => ['name' => 'media_description_raw', 'type' => 'string', 'internal' => 'descriptionRaw'], 'media_versioned' => ['name' => 'media_versioned', 'type' => 'bool', 'internal' => 'versioned'], @@ -61,7 +62,7 @@ class MediaMapper extends DataMapperAbstract protected static array $belongsTo = [ 'createdBy' => [ 'mapper' => AccountMapper::class, - 'self' => 'media_created_by', + 'external' => 'media_created_by', ], ];