1 | <?php |
||
9 | class Connection extends \Illuminate\Database\Connection |
||
10 | { |
||
11 | /** |
||
12 | * The Cassandra keyspace |
||
13 | * |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $keyspace; |
||
17 | |||
18 | /** |
||
19 | * The Cassandra connection handler. |
||
20 | * |
||
21 | * @var \Cassandra\Session |
||
22 | */ |
||
23 | protected $session; |
||
24 | |||
25 | /** |
||
26 | * The config |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $config; |
||
31 | |||
32 | /** |
||
33 | * The Cassandra cluster |
||
34 | * |
||
35 | * @var \Cassandra\Cluster |
||
36 | */ |
||
37 | protected $cluster; |
||
38 | |||
39 | /** |
||
40 | * Connection constructor. |
||
41 | * @param Cassandra\Cluster $cluster |
||
42 | * @param array $config |
||
43 | */ |
||
44 | public function __construct(\Cassandra\Cluster $cluster, array $config) |
||
60 | 48 | ||
61 | 48 | /** |
|
62 | * Get keyspace name from config |
||
63 | * |
||
64 | 48 | * @param array $config |
|
65 | * |
||
66 | 48 | * @return string|null |
|
67 | */ |
||
68 | 48 | protected function getDatabase(array $config) |
|
78 | |||
79 | 5 | /** |
|
80 | * Begin a fluent query against a database table. |
||
81 | 5 | * |
|
82 | * @param string $table |
||
83 | 5 | * @return Query\Builder |
|
84 | */ |
||
85 | public function table($table) |
||
93 | 1 | ||
94 | /** |
||
95 | * return Cassandra cluster. |
||
96 | * |
||
97 | * @return \Cassandra\Cluster |
||
98 | */ |
||
99 | public function getCassandraCluster() |
||
103 | 3 | ||
104 | /** |
||
105 | * return Cassandra Session. |
||
106 | * |
||
107 | * @return \Cassandra\Session |
||
108 | */ |
||
109 | public function getCassandraSession() |
||
113 | 1 | ||
114 | /** |
||
115 | * Return the Cassandra keyspace |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | public function getKeyspace() |
||
123 | 48 | ||
124 | /** |
||
125 | * Disconnect from the underlying Cassandra connection. |
||
126 | 48 | */ |
|
127 | 48 | public function disconnect() |
|
132 | |||
133 | 48 | /** |
|
134 | 48 | * Get the PDO driver name. |
|
135 | * |
||
136 | * @return string |
||
137 | 48 | */ |
|
138 | public function getDriverName() |
||
142 | |||
143 | 48 | /** |
|
144 | * Run a select statement against the database. |
||
145 | * |
||
146 | * @param string $query |
||
147 | * @param array $bindings |
||
148 | * @param bool $useReadPdo |
||
149 | * @param array $customOptions |
||
150 | * |
||
151 | * @return mixed |
||
152 | 48 | */ |
|
153 | public function select($query, $bindings = [], $useReadPdo = true, array $customOptions = []) |
||
157 | |||
158 | /** |
||
159 | * Run an bulk insert statement against the database. |
||
160 | * |
||
161 | 48 | * @param array $queries |
|
162 | * @param array $bindings |
||
163 | * @param int $type |
||
164 | 48 | * @param array $customOptions |
|
165 | 48 | * |
|
166 | * @return bool |
||
167 | */ |
||
168 | 48 | public function insertBulk($queries = [], $bindings = [], $type = Cassandra::BATCH_LOGGED, array $customOptions = []) |
|
172 | 48 | ||
173 | 48 | /** |
|
174 | * Execute a group of queries inside a batch statement against the database. |
||
175 | * |
||
176 | 48 | * @param array $queries |
|
177 | 48 | * @param array $bindings |
|
178 | * @param int $type |
||
179 | * @param array $customOptions |
||
180 | * |
||
181 | * @return bool |
||
182 | */ |
||
183 | public function batchStatement($queries = [], $bindings = [], $type = Cassandra::BATCH_LOGGED, array $customOptions = []) |
||
200 | |||
201 | 3 | /** |
|
202 | 3 | * Execute an CQL statement and return the boolean result. |
|
203 | 3 | * |
|
204 | * @param string $query |
||
205 | * @param array $bindings |
||
206 | * @param array $customOptions |
||
207 | * |
||
208 | * @return mixed |
||
209 | */ |
||
210 | 1 | public function statement($query, $bindings = [], array $customOptions = []) |
|
214 | |||
215 | /** |
||
216 | * Because Cassandra is an eventually consistent database, it's not possible to obtain |
||
217 | * the affected count for statements so we're just going to return 0, based on the idea |
||
218 | * that if the query fails somehow, an exception will be thrown |
||
219 | * |
||
220 | * @param string $query |
||
221 | * @param array $bindings |
||
222 | * @param array $customOptions |
||
223 | * |
||
224 | * @return int |
||
225 | 48 | */ |
|
226 | public function affectingStatement($query, $bindings = [], array $customOptions = []) |
||
230 | |||
231 | /** |
||
232 | * @inheritdoc |
||
233 | */ |
||
234 | protected function getDefaultPostProcessor() |
||
238 | |||
239 | /** |
||
240 | 6 | * @inheritdoc |
|
241 | */ |
||
242 | 6 | protected function getDefaultQueryGrammar() |
|
246 | |||
247 | /** |
||
248 | * @inheritdoc |
||
249 | */ |
||
250 | protected function getDefaultSchemaGrammar() |
||
254 | |||
255 | /** |
||
256 | * Reconnect to the database if connection is missing. |
||
257 | 7 | * |
|
258 | 7 | * @return void |
|
259 | 1 | */ |
|
260 | protected function reconnectIfMissingConnection() |
||
266 | 6 | ||
267 | /** |
||
268 | * Dynamically pass methods to the connection. |
||
269 | 6 | * |
|
270 | 7 | * @param string $method |
|
271 | * @param array $parameters |
||
272 | * @return mixed |
||
273 | */ |
||
274 | public function __call($method, $parameters) |
||
278 | |||
279 | /** |
||
280 | * Execute an CQL statement and return the boolean result. |
||
281 | * |
||
282 | 48 | * @param string $query |
|
283 | * @param array $bindings |
||
284 | 48 | * @param array $customOptions |
|
285 | * @param mixed $defaultFailed |
||
286 | * @param mixed $defaultSuccess |
||
287 | * |
||
288 | * @return mixed |
||
289 | */ |
||
290 | protected function runStatement($query, $bindings = [], array $customOptions = [], $defaultFailed = [], $defaultSuccess = null) |
||
307 | |||
308 | 48 | /** |
|
309 | * @inheritDoc |
||
310 | */ |
||
311 | public function transaction(\Closure $callback, $attempts = 1) |
||
315 | |||
316 | 48 | /** |
|
317 | * @inheritDoc |
||
318 | */ |
||
319 | public function beginTransaction() |
||
323 | |||
324 | /** |
||
325 | 48 | * @inheritDoc |
|
326 | */ |
||
327 | public function commit() |
||
331 | |||
332 | 48 | /** |
|
333 | * @inheritDoc |
||
334 | 48 | */ |
|
335 | 1 | public function rollBack() |
|
339 | |||
340 | /** |
||
341 | * @inheritDoc |
||
342 | */ |
||
343 | public function transactionLevel() |
||
347 | |||
348 | 1 | //TODO: override isDoctrineAvailable method |
|
349 | //TODO: override getDoctrineColumn method |
||
350 | //TODO: override getDoctrineSchemaManager method |
||
351 | //TODO: override getDoctrineConnection method |
||
352 | //TODO: override getPdo method |
||
353 | //TODO: override getReadPdo method |
||
354 | //TODO: override setPdo method |
||
355 | //TODO: override setReadPdo method |
||
356 | //TODO: override setReconnector method |
||
357 | //TODO: override reconnect method |
||
358 | //TODO: override query method |
||
359 | |||
360 | //TODO: override bindValues method |
||
361 | //TODO: override cursor method |
||
362 | //TODO: override unprepared method |
||
363 | |||
364 | 48 | //TODO: check prepareBindings method |
|
365 | 48 | ||
366 | 2 | //TODO: provide interface for $this->session->executeAsync |
|
367 | //TODO: provide interface for $this->session->prepareAsync |
||
368 | //TODO: provide interface for $this->session->closeAsync |
||
369 | 48 | //TODO: provide interface for $this->session->schema |
|
370 | } |
||
371 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: