1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace kalanis\kw_auth\Sources\Mapper\Database; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
use kalanis\kw_auth\Interfaces\IGroup; |
7
|
|
|
use kalanis\kw_mapper\Interfaces\IEntryType; |
8
|
|
|
use kalanis\kw_mapper\Records\ASimpleRecord; |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Class GroupsRecord |
13
|
|
|
* @package kalanis\kw_auth\Sources\Mapper\Database |
14
|
|
|
* @property int $id |
15
|
|
|
* @property string $name |
16
|
|
|
* @property string $desc |
17
|
|
|
* @property int $status |
18
|
|
|
* @property int $authorId |
19
|
|
|
* @property UsersRecord[] $authors |
20
|
|
|
* @property UsersRecord[] $members |
21
|
|
|
* @codeCoverageIgnore remote source |
22
|
|
|
*/ |
23
|
|
|
class GroupsRecord extends ASimpleRecord implements IGroup |
24
|
|
|
{ |
25
|
|
|
public function addEntries(): void |
26
|
|
|
{ |
27
|
|
|
$this->addEntry('id', IEntryType::TYPE_INTEGER, 2048); |
28
|
|
|
$this->addEntry('name', IEntryType::TYPE_STRING, 512); |
29
|
|
|
$this->addEntry('desc', IEntryType::TYPE_STRING, 512); |
30
|
|
|
$this->addEntry('authorId', IEntryType::TYPE_INTEGER, 128); |
31
|
|
|
$this->addEntry('status', IEntryType::TYPE_INTEGER, 4); |
32
|
|
|
$this->addEntry('authors', IEntryType::TYPE_ARRAY, []); |
33
|
|
|
$this->addEntry('members', IEntryType::TYPE_ARRAY, []); |
34
|
|
|
$this->setMapper(GroupsMapper::class); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
public function getGroupId(): int |
38
|
|
|
{ |
39
|
|
|
return intval($this->id); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function getGroupName(): string |
43
|
|
|
{ |
44
|
|
|
return strval($this->name); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function getGroupDesc(): string |
48
|
|
|
{ |
49
|
|
|
return strval($this->desc); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function getGroupAuthorId(): int |
53
|
|
|
{ |
54
|
|
|
return intval($this->authorId); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function getGroupStatus(): int |
58
|
|
|
{ |
59
|
|
|
return intval($this->status); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|