Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
Apikey
100.00% covered (success)
100.00%
16 / 16
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 addRequiredJoins
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 getEntityMapping
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
1
 addConditionApikey
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace BO\Zmsbackend\Apikey\Repository;
4
5/**
6 * @SuppressWarnings(Public)
7 */
8class Apikey extends \BO\Zmsbackend\Query\Base implements \BO\Zmsbackend\Query\MappingInterface
9{
10    /**
11     * @var String TABLE mysql table reference
12     */
13    const string TABLE = 'apikey';
14
15    const string QUOTATABLE = 'apiquota';
16
17    /**
18     * @return void
19     */
20    #[\Override]
21    protected function addRequiredJoins()
22    {
23        $this->leftJoin(
24            new \BO\Zmsbackend\Query\Alias('apiclient', 'apiclientkey'),
25            'apikey.apiClientID',
26            '=',
27            'apiclientkey.apiClientID'
28        );
29    }
30
31
32    /**
33     * @return string[]
34     *
35     */
36    #[\Override]
37    public function getEntityMapping()
38    {
39        $mapping = [
40            'key' => 'apikey.key',
41            'createIP' => 'apikey.createIP',
42            'apiclient__clientKey' => 'apiclientkey.clientKey',
43            'apiclient__accesslevel' => 'apiclientkey.accesslevel',
44            'ts' => 'apikey.ts'
45        ];
46        return $mapping;
47    }
48
49    public function addConditionApikey($apikey): static
50    {
51        $this->query->where('apikey.key', '=', $apikey);
52        return $this;
53    }
54}