Passed
Branch master (ecaff5)
by Joao
02:24
created

DummyHexRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace RestTemplate\Repository;
4
5
use Builder\Psr11;
6
use ByJG\AnyDataset\Db\DbDriverInterface;
7
use ByJG\Config\Exception\ConfigNotFoundException;
8
use ByJG\Config\Exception\EnvironmentException;
9
use ByJG\Config\Exception\KeyNotFoundException;
10
use ByJG\MicroOrm\Exception\OrmModelInvalidException;
11
use ByJG\MicroOrm\Mapper;
12
use ByJG\MicroOrm\Repository;
13
use Psr\SimpleCache\InvalidArgumentException;
14
use ReflectionException;
15
use RestTemplate\Model\DummyHex;
16
17
class DummyHexRepository extends BaseRepository
18
{
19
    /**
20
     * DummyRepository constructor.
21
     *
22
     * @param DbDriverInterface $dbDriver
23
     *
24
     * @throws ConfigNotFoundException
25
     * @throws EnvironmentException
26
     * @throws InvalidArgumentException
27
     * @throws KeyNotFoundException
28
     * @throws \ByJG\MicroOrm\Exception\InvalidArgumentException
29
     * @throws OrmModelInvalidException
30
     * @throws ReflectionException
31
     */
32
    public function __construct(DbDriverInterface $dbDriver)
33
    {
34
        $mapper = new Mapper(
35
            DummyHex::class,
36
            'dummyhex',
37
            'id',
38
            Psr11::container()->raw("_CLOSURE_NEWKEY")
39
        );
40
41
        Psr11::container()->get('_CLOSURE_FIELDMAP_ID', $mapper);
42
        $mapper->addFieldMap('uuid', 'uuid', Mapper::doNotUpdateClosure());
43
44
        $this->repository = new Repository($dbDriver, $mapper);
45
    }
46
}
47