mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-02-17 09:48:41 +00:00
correct datamapper self/external usage (invert)
This commit is contained in:
parent
41c1cb2b28
commit
0e0e0d1042
|
|
@ -14,6 +14,11 @@
|
||||||
"type": "VARCHAR(255)",
|
"type": "VARCHAR(255)",
|
||||||
"null": false
|
"null": false
|
||||||
},
|
},
|
||||||
|
"media_type": {
|
||||||
|
"name": "media_type",
|
||||||
|
"type": "VARCHAR(255)",
|
||||||
|
"null": false
|
||||||
|
},
|
||||||
"media_description": {
|
"media_description": {
|
||||||
"name": "media_description",
|
"name": "media_description",
|
||||||
"type": "TEXT",
|
"type": "TEXT",
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,14 @@ use phpOMS\Module\WebInterface;
|
||||||
*/
|
*/
|
||||||
class Controller extends ModuleAbstract implements WebInterface
|
class Controller extends ModuleAbstract implements WebInterface
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* File path
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public const FILE_PATH = __DIR__ . '/../Files';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Module path.
|
* Module path.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ final class CollectionMapper extends MediaMapper
|
||||||
'sources' => [
|
'sources' => [
|
||||||
'mapper' => MediaMapper::class,
|
'mapper' => MediaMapper::class,
|
||||||
'table' => 'media_relation',
|
'table' => 'media_relation',
|
||||||
'external' => 'media_relation_dst',
|
'external' => 'media_relation_src',
|
||||||
'self' => 'media_relation_src',
|
'self' => 'media_relation_dst',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,14 @@ class Media implements \JsonSerializable
|
||||||
*/
|
*/
|
||||||
protected string $name = '';
|
protected string $name = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected string $type = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension.
|
* Extension.
|
||||||
*
|
*
|
||||||
|
|
@ -360,6 +368,16 @@ class Media implements \JsonSerializable
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function getType() : string
|
||||||
|
{
|
||||||
|
return $this->type;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
|
|
@ -460,6 +478,19 @@ class Media implements \JsonSerializable
|
||||||
$this->name = $name;
|
$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
|
* @param string $description Media description
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ class MediaMapper extends DataMapperAbstract
|
||||||
protected static array $columns = [
|
protected static array $columns = [
|
||||||
'media_id' => ['name' => 'media_id', 'type' => 'int', 'internal' => 'id'],
|
'media_id' => ['name' => 'media_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'media_name' => ['name' => 'media_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
|
'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' => ['name' => 'media_description', 'type' => 'string', 'internal' => 'description', 'autocomplete' => true],
|
||||||
'media_description_raw' => ['name' => 'media_description_raw', 'type' => 'string', 'internal' => 'descriptionRaw'],
|
'media_description_raw' => ['name' => 'media_description_raw', 'type' => 'string', 'internal' => 'descriptionRaw'],
|
||||||
'media_versioned' => ['name' => 'media_versioned', 'type' => 'bool', 'internal' => 'versioned'],
|
'media_versioned' => ['name' => 'media_versioned', 'type' => 'bool', 'internal' => 'versioned'],
|
||||||
|
|
@ -61,7 +62,7 @@ class MediaMapper extends DataMapperAbstract
|
||||||
protected static array $belongsTo = [
|
protected static array $belongsTo = [
|
||||||
'createdBy' => [
|
'createdBy' => [
|
||||||
'mapper' => AccountMapper::class,
|
'mapper' => AccountMapper::class,
|
||||||
'self' => 'media_created_by',
|
'external' => 'media_created_by',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user