PedigreeRelateRecord::addEntries()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
ccs 7
cts 7
cp 1
crap 1
rs 10
1
<?php
2
3
namespace kalanis\kw_pedigree\Storage\MultiTable;
4
5
6
use kalanis\kw_mapper\Interfaces\IEntryType;
7
use kalanis\kw_mapper\Records\ASimpleRecord;
8
9
10
/**
11
 * Class PedigreeRelateRecord
12
 * @property int $id
13
 * @property int $childId
14
 * @property int $parentId
15
 * @property PedigreeItemRecord[] $parents
16
 * @property PedigreeItemRecord[] $children
17
 */
18
class PedigreeRelateRecord extends ASimpleRecord
19
{
20 4
    protected function addEntries(): void
21
    {
22 4
        $this->addEntry('id', IEntryType::TYPE_INTEGER, 2048);
23 4
        $this->addEntry('childId', IEntryType::TYPE_INTEGER, 2048);
24 4
        $this->addEntry('parentId', IEntryType::TYPE_INTEGER, 2048);
25 4
        $this->addEntry('parents', IEntryType::TYPE_ARRAY); // FK - makes the array of entries every time
26 4
        $this->addEntry('children', IEntryType::TYPE_ARRAY); // FK - makes the array of entries every time
27 4
        $this->setMapper($this->getMapperClass());
28 4
    }
29
30
    /**
31
     * @return string
32
     * @codeCoverageIgnore used another one for testing
33
     */
34
    protected function getMapperClass(): string
35
    {
36
        return PedigreeRelateMapper::class;
37
    }
38
}
39