Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
47.37% covered (danger)
47.37%
9 / 19
40.00% covered (danger)
40.00%
2 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
Closure
47.37% covered (danger)
47.37%
9 / 19
40.00% covered (danger)
40.00%
2 / 5
8.64
0.00% covered (danger)
0.00%
0 / 1
 getEntityMapping
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
1
 addConditionDate
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
 addConditionScopeId
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 addConditionId
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 postProcess
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace BO\Zmsdb\Query;
4
5use DateTime;
6
7class Closure extends Base implements MappingInterface
8{
9    /**
10     * @var String TABLE mysql table reference
11     */
12    const TABLE = 'closures';
13
14    /**
15     * No resolving required here
16     */
17    protected $resolveLevel = 0;
18
19    public function getEntityMapping()
20    {
21        return [
22            'id' => 'closure.id',
23            'year' => 'closure.year',
24            'month' => 'closure.month',
25            'day' => 'closure.day',
26            'lastChange' => 'closure.updateTimestamp'
27        ];
28    }
29
30    public function addConditionDate(DateTime $date)
31    {
32        $this->query->where('closure.year', '=', $date->format('Y'));
33        $this->query->where('closure.month', '=', $date->format('m'));
34        $this->query->where('closure.day', '=', $date->format('d'));
35        return $this;
36    }
37
38    public function addConditionScopeId($scopeId)
39    {
40        $this->query->where('closure.StandortID', '=', $scopeId);
41        return $this;
42    }
43
44    public function addConditionId($id)
45    {
46        $this->query->where('closure.id', '=', $id);
47        return $this;
48    }
49
50    public function postProcess($data)
51    {
52        $data[$this->getPrefixed("lastChange")] =
53            (new \DateTime($data[$this->getPrefixed("lastChange")] . \BO\Zmsdb\Connection\Select::$connectionTimezone))
54            ->getTimestamp();
55        return $data;
56    }
57}