Passed
Branch develop (078eb3)
by Andrew
05:54 queued 03:15
created

Query::createCommand()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * Connect plugin for Craft CMS 3.x
4
 *
5
 * Allows you to connect to external databases and perform db queries
6
 *
7
 * @link      https://nystudio107.com/
8
 * @copyright Copyright (c) 2018 nystudio107
9
 */
10
11
namespace nystudio107\connect\db;
12
13
use yii\db\Connection;
14
15
/**
16
 * @author    nystudio107
17
 * @package   Connect
18
 * @since     1.0.0
19
 */
20
class Query extends \yii\db\Query
21
{
22
    // Public Properties
23
    // =========================================================================
24
25
    /**
26
     * @var Connection the database connections
27
     */
28
    public $db = null;
29
30
    // Public Methods
31
    // =========================================================================
32
33
    /**
34
     * @inheritdoc
35
     */
36
    public function createCommand($db = null)
37
    {
38
        return parent::createCommand($db ?? $this->db);
39
    }
40
    
41
    /**
42
     * @inheritdoc
43
     */
44
    public function batch($batchSize = 100, $db = null)
45
    {
46
        return parent::batch($batchSize, $db ?? $this->db);
47
    }
48
49
    /**
50
     * @inheritdoc
51
     */
52
    public function each($batchSize = 100, $db = null)
53
    {
54
        return parent::each($batchSize, $db ?? $this->db);
55
    }
56
57
    /**
58
     * @inheritdoc
59
     */
60
    public function all($db = null)
61
    {
62
        return parent::all($db ?? $this->db);
63
    }
64
65
    /**
66
     * @inheritdoc
67
     */
68
    public function one($db = null)
69
    {
70
        return parent::one($db ?? $this->db);
71
    }
72
73
    /**
74
     * @inheritdoc
75
     */
76
    public function scalar($db = null)
77
    {
78
        return parent::scalar($db ?? $this->db);
79
    }
80
81
    /**
82
     * @inheritdoc
83
     */
84
    public function column($db = null)
85
    {
86
        return parent::column($db ?? $this->db);
87
    }
88
89
    /**
90
     * @inheritdoc
91
     */
92
    public function count($q = '*', $db = null)
93
    {
94
        return parent::count($q, $db ?? $this->db);
0 ignored issues
show
Bug Best Practice introduced by
The expression return parent::count($q, $db ?? $this->db) also could return the type string which is incompatible with the return type mandated by yii\db\QueryInterface::count() of integer.
Loading history...
95
    }
96
97
    /**
98
     * @inheritdoc
99
     */
100
    public function sum($q, $db = null)
101
    {
102
        return parent::sum($q, $db ?? $this->db);
103
    }
104
105
    /**
106
     * @inheritdoc
107
     */
108
    public function average($q, $db = null)
109
    {
110
        return parent::average($q, $db ?? $this->db);
111
    }
112
113
    /**
114
     * @inheritdoc
115
     */
116
    public function min($q, $db = null)
117
    {
118
        return parent::min($q, $db ?? $this->db);
119
    }
120
121
    /**
122
     * @inheritdoc
123
     */
124
    public function max($q, $db = null)
125
    {
126
        return parent::max($q, $db ?? $this->db);
127
    }
128
129
    /**
130
     * @inheritdoc
131
     */
132
    public function exists($db = null)
133
    {
134
        return parent::exists($db ?? $this->db);
135
    }
136
}
137