|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace kalanis\kw_pedigree\Storage\MultiTable; |
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
use kalanis\kw_mapper\Interfaces\IEntryType; |
|
7
|
|
|
use kalanis\kw_pedigree\Interfaces\ISex; |
|
8
|
|
|
use kalanis\kw_pedigree\Storage\APedigreeRecord; |
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Class PedigreeItemRecord |
|
13
|
|
|
* @property PedigreeRelateRecord[] $parents |
|
14
|
|
|
* @property PedigreeRelateRecord[] $children |
|
15
|
|
|
*/ |
|
16
|
|
|
class PedigreeItemRecord extends APedigreeRecord |
|
17
|
|
|
{ |
|
18
|
9 |
|
protected function addEntries(): void |
|
19
|
|
|
{ |
|
20
|
9 |
|
$this->addEntry('id', IEntryType::TYPE_INTEGER, 2048); |
|
21
|
9 |
|
$this->addEntry('short', IEntryType::TYPE_STRING, 50); |
|
22
|
9 |
|
$this->addEntry('name', IEntryType::TYPE_STRING, 75); |
|
23
|
9 |
|
$this->addEntry('family', IEntryType::TYPE_STRING, 255); |
|
24
|
9 |
|
$this->addEntry('birth', IEntryType::TYPE_STRING, 32); |
|
25
|
9 |
|
$this->addEntry('death', IEntryType::TYPE_STRING, 32); |
|
26
|
9 |
|
$this->addEntry('successes', IEntryType::TYPE_STRING, 255); |
|
27
|
9 |
|
$this->addEntry('sex', IEntryType::TYPE_SET, [ISex::FEMALE, ISex::MALE]); |
|
28
|
9 |
|
$this->addEntry('text', IEntryType::TYPE_STRING, 8192); |
|
29
|
9 |
|
$this->addEntry('parents', IEntryType::TYPE_ARRAY); // FK - makes the array of entries every time |
|
30
|
9 |
|
$this->addEntry('children', IEntryType::TYPE_ARRAY); // FK - makes the array of entries every time |
|
31
|
9 |
|
$this->setMapper($this->getMapperClass()); |
|
32
|
9 |
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @return string |
|
36
|
|
|
* @codeCoverageIgnore used another one for testing |
|
37
|
|
|
*/ |
|
38
|
1 |
|
protected function getMapperClass(): string |
|
39
|
|
|
{ |
|
40
|
1 |
|
return PedigreeItemMapper::class; |
|
41
|
|
|
} |
|
42
|
|
|
} |
|
43
|
|
|
|