Lines 100.00% 14 / 14
Functions and Methods 100.00% 3 / 3
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
Apiclient 100.00% 14 / 14 100.00% 3 / 3 3 100.00% 1 / 1
 getEntityMapping 100.00% 8 / 8 100.00% 1 / 1 1
 addConditionApiclientKey 100.00% 2 / 2 100.00% 1 / 1 1
 postProcess 100.00% 4 / 4 100.00% 1 / 1 1
1<?php
2
3namespace BO\Zmsbackend\Apikey\Repository;
4
5/**
6 * @SuppressWarnings(Public)
7 */
8class Apiclient extends \BO\Zmsbackend\Query\Base implements \BO\Zmsbackend\Query\MappingInterface
9{
10    /**
11     * @var String TABLE mysql table reference
12     */
13    const string TABLE = 'apiclient';
14
15    /**
16     * @return string[]
17     *
18     */
19    #[\Override]
20    public function getEntityMapping()
21    {
22        $mapping = [
23            'apiClientID' => 'apiclient.apiClientID',
24            'clientKey' => 'apiclient.clientKey',
25            'shortname' => 'apiclient.shortname',
26            'accesslevel' => 'apiclient.accesslevel',
27            'lastChange' => 'apiclient.updateTimestamp',
28        ];
29        return $mapping;
30    }
31
32    public function addConditionApiclientKey($clientKey): static
33    {
34        $this->query->where('apiclient.clientKey', '=', $clientKey);
35        return $this;
36    }
37
38    #[\Override]
39    public function postProcess($data)
40    {
41        $data[$this->getPrefixed("lastChange")] =
42            (new \DateTime($data[$this->getPrefixed("lastChange")] . \BO\Zmsbackend\Connection\Select::$connectionTimezone))
43            ->getTimestamp();
44        return $data;
45    }
46}