|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @copyright Copyright (c) Flipbox Digital Limited |
|
5
|
|
|
* @license https://flipboxfactory.com/software/patron/license |
|
6
|
|
|
* @link https://www.flipboxfactory.com/software/patron/ |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace flipbox\patron\db; |
|
10
|
|
|
|
|
11
|
|
|
use craft\db\QueryAbortedException; |
|
12
|
|
|
use flipbox\ember\db\traits\AuditAttributes; |
|
13
|
|
|
use flipbox\ember\db\traits\FixedOrderBy; |
|
14
|
|
|
use flipbox\patron\records\ProviderLock; |
|
15
|
|
|
use yii\db\ActiveQuery; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @author Flipbox Factory <[email protected]> |
|
19
|
|
|
* @since 1.0.0 |
|
20
|
|
|
*/ |
|
21
|
|
|
class ProviderLockActiveQuery extends ActiveQuery |
|
22
|
|
|
{ |
|
23
|
|
|
use FixedOrderBy, |
|
24
|
|
|
AuditAttributes; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @inheritdoc |
|
28
|
|
|
*/ |
|
29
|
|
|
public function init() |
|
30
|
|
|
{ |
|
31
|
|
|
parent::init(); |
|
32
|
|
|
|
|
33
|
|
|
if ($this->from === null) { |
|
34
|
|
|
$this->from = [ProviderLock::tableName() . ' ' . ProviderLock::tableAlias()]; |
|
35
|
|
|
} |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @inheritdoc |
|
40
|
|
|
*/ |
|
41
|
|
|
public $orderBy = ['dateCreated' => SORT_DESC]; |
|
42
|
|
|
|
|
43
|
|
|
/******************************************* |
|
44
|
|
|
* FIXED ORDER |
|
45
|
|
|
*******************************************/ |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @inheritdoc |
|
49
|
|
|
*/ |
|
50
|
|
|
protected function fixedOrderColumn(): string |
|
51
|
|
|
{ |
|
52
|
|
|
return 'pluginId'; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/******************************************* |
|
56
|
|
|
* PREPARE |
|
57
|
|
|
*******************************************/ |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @inheritdoc |
|
61
|
|
|
* |
|
62
|
|
|
* @throws QueryAbortedException if it can be determined that there won’t be any results |
|
63
|
|
|
*/ |
|
64
|
|
|
public function prepare($builder) |
|
65
|
|
|
{ |
|
66
|
|
|
// Is the query already doomed? |
|
67
|
|
|
if (($this->plugin !== null && empty($this->plugin)) || |
|
|
|
|
|
|
68
|
|
|
($this->provider !== null && empty($this->provider)) |
|
|
|
|
|
|
69
|
|
|
) { |
|
70
|
|
|
throw new QueryAbortedException(); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
$this->applyAuditAttributeConditions(); |
|
74
|
|
|
$this->applyOrderByParams($builder->db); |
|
75
|
|
|
|
|
76
|
|
|
return parent::prepare($builder); |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.