1 | <?php |
||
2 | /** |
||
3 | * Socializer plugin for Craft CMS 3.x |
||
4 | * |
||
5 | * @link https://enupal.com/ |
||
6 | * @copyright Copyright (c) 2019 Enupal LLC |
||
7 | */ |
||
8 | |||
9 | namespace enupal\socializer\elements\db; |
||
10 | |||
11 | use craft\elements\db\ElementQuery; |
||
12 | use craft\helpers\Db; |
||
13 | |||
14 | class ProvidersQuery extends ElementQuery |
||
15 | { |
||
16 | |||
17 | // General - Properties |
||
18 | // ========================================================================= |
||
19 | public $name; |
||
20 | public $handle; |
||
21 | public $type; |
||
22 | public $clientId; |
||
23 | public $clientSecret; |
||
24 | public $fieldMapping; |
||
25 | |||
26 | /** |
||
27 | * @inheritdoc |
||
28 | */ |
||
29 | public function __set($name, $value) |
||
30 | { |
||
31 | parent::__set($name, $value); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @inheritdoc |
||
36 | */ |
||
37 | public function type($value) |
||
38 | { |
||
39 | $this->type = $value; |
||
40 | |||
41 | return $this; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @inheritdoc |
||
46 | */ |
||
47 | public function getType() |
||
48 | { |
||
49 | return $this->type; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @inheritdoc |
||
54 | */ |
||
55 | public function name($value) |
||
56 | { |
||
57 | $this->name = $value; |
||
58 | |||
59 | return $this; |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * @inheritdoc |
||
64 | */ |
||
65 | public function handle($value) |
||
66 | { |
||
67 | $this->handle = $value; |
||
68 | |||
69 | return $this; |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @inheritdoc |
||
74 | */ |
||
75 | public function getName() |
||
76 | { |
||
77 | return $this->name; |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * @inheritdoc |
||
82 | */ |
||
83 | public function __construct($elementType, array $config = []) |
||
84 | { |
||
85 | // Default orderBy |
||
86 | if (!isset($config['orderBy'])) { |
||
87 | $config['orderBy'] = 'enupalsocializer_providers.dateCreated'; |
||
88 | } |
||
89 | |||
90 | parent::__construct($elementType, $config); |
||
91 | } |
||
92 | |||
93 | |||
94 | // Protected Methods |
||
95 | // ========================================================================= |
||
96 | |||
97 | /** |
||
98 | * @inheritdoc |
||
99 | */ |
||
100 | protected function beforePrepare(): bool |
||
101 | { |
||
102 | $this->joinElementTable('enupalsocializer_providers'); |
||
103 | |||
104 | if (is_null($this->query)){ |
||
105 | return false; |
||
106 | } |
||
107 | |||
108 | $this->query->select([ |
||
109 | 'enupalsocializer_providers.id', |
||
110 | 'enupalsocializer_providers.name', |
||
111 | 'enupalsocializer_providers.handle', |
||
112 | 'enupalsocializer_providers.type', |
||
113 | 'enupalsocializer_providers.clientId', |
||
114 | 'enupalsocializer_providers.clientSecret', |
||
115 | 'enupalsocializer_providers.fieldMapping' |
||
116 | ]); |
||
117 | |||
118 | if ($this->name) { |
||
119 | $this->subQuery->andWhere(Db::parseParam( |
||
0 ignored issues
–
show
|
|||
120 | 'enupalsocializer_providers.name', $this->name) |
||
121 | ); |
||
122 | } |
||
123 | |||
124 | if ($this->handle) { |
||
125 | $this->subQuery->andWhere(Db::parseParam( |
||
126 | 'enupalsocializer_providers.handle', $this->handle) |
||
127 | ); |
||
128 | } |
||
129 | |||
130 | if ($this->type) { |
||
131 | $this->subQuery->andWhere(Db::parseParam( |
||
132 | 'enupalsocializer_providers.type', $this->type) |
||
133 | ); |
||
134 | } |
||
135 | |||
136 | if ($this->orderBy !== null && empty($this->orderBy) && !$this->structureId && !$this->fixedOrder) { |
||
137 | $this->orderBy = 'dateCreated desc'; |
||
0 ignored issues
–
show
It seems like
'dateCreated desc' of type string is incompatible with the declared type array|null of property $orderBy .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
138 | } |
||
139 | |||
140 | return parent::beforePrepare(); |
||
141 | } |
||
142 | } |
||
143 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.