Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
73.68% covered (warning)
73.68%
14 / 19
60.00% covered (warning)
60.00%
3 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
MailQueue
73.68% covered (warning)
73.68%
14 / 19
60.00% covered (warning)
60.00%
3 / 5
6.66
0.00% covered (danger)
0.00%
0 / 1
 getEntityMapping
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
1
 addConditionItemId
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 addOrderBy
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 addWhereIn
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
 selectFields
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace BO\Zmsdb\Query;
4
5class MailQueue extends Base
6{
7    /**
8     * @var String TABLE mysql table reference
9     */
10    const TABLE = 'mailqueue';
11
12    const QUERY_DELETE = '
13        DELETE mq,  mp
14            FROM ' . self::TABLE . ' mq
15            LEFT JOIN ' . Mimepart::TABLE . ' mp ON mp.queueId = mq.id
16            WHERE mq.id=?
17    ';
18
19    const QUERY_MULTI_DELETE = '
20        DELETE mq, mp
21        FROM ' . self::TABLE . ' mq
22        LEFT JOIN ' . Mimepart::TABLE . ' mp ON mp.queueId = mq.id
23        WHERE mq.id IN (?)
24    ';
25
26    public function getEntityMapping()
27    {
28        return [
29            'id' => 'mailQueue.id',
30            'createIP' => 'mailQueue.createIP',
31            'createTimestamp' => 'mailQueue.createTimestamp',
32            'subject' => 'mailQueue.subject',
33            'client__email' => 'mailQueue.clientEmail',
34            'client__familyName' => 'mailQueue.clientFamilyName',
35            'process__id' => 'mailQueue.processID',
36            'department__id' => 'mailQueue.departmentID'
37        ];
38    }
39
40    public function addConditionItemId($itemId)
41    {
42        $this->query->where('mailQueue.id', '=', $itemId);
43        return $this;
44    }
45
46    public function addOrderBy($parameter, $order = 'ASC')
47    {
48        $this->query->orderBy('mailQueue.' . $parameter, $order);
49        return $this;
50    }
51
52    public function addWhereIn($column, array $itemIds)
53    {
54        if (!empty($itemIds)) {
55            $this->query->where($column, 'IN', $itemIds);
56        }
57        return $this;
58    }
59
60    public function selectFields(array $fields)
61    {
62        $this->query->select($fields);
63        return $this;
64    }
65}