Passed
Push — master ( d309df...7ec489 )
by Petr
02:37
created

GroupsMapper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 10
c 1
b 0
f 1
dl 0
loc 13
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A setMap() 0 11 1
1
<?php
2
3
namespace kalanis\kw_auth\Sources\Mapper\Database;
4
5
6
use kalanis\kw_mapper\Mappers\Database\ADatabase;
7
8
9
/**
10
 * Class GroupsMapper
11
 * @package kalanis\kw_auth\Data\Mapper\Database
12
 * @codeCoverageIgnore remote source
13
 */
14
class GroupsMapper extends ADatabase
15
{
16
    protected function setMap(): void
17
    {
18
        $this->setSource('default_database');
19
        $this->setTable('groups');
20
        $this->setRelation('id', 'gr_id');
21
        $this->setRelation('name', 'gr_name');
22
        $this->setRelation('authorId', 'u_id');
23
        $this->setRelation('desc', 'gr_desc');
24
        $this->addPrimaryKey('id');
25
        $this->addForeignKey('authors', '\kalanis\kw_auth\Sources\Mapper\Database\UsersRecord', 'authorId', 'id');
26
        $this->addForeignKey('members', '\kalanis\kw_auth\Sources\Mapper\Database\UsersRecord', 'id', 'groupId');
27
    }
28
}
29