1 | <?php |
||
8 | class Connection extends \Illuminate\Database\Connection |
||
9 | { |
||
10 | const DEFAULT_PAGE_SIZE = 5000; |
||
11 | |||
12 | /** |
||
13 | * The Cassandra keyspace |
||
14 | * |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $keyspace; |
||
18 | |||
19 | /** |
||
20 | * The Cassandra cluster |
||
21 | * |
||
22 | * @var \Cassandra\Cluster |
||
23 | */ |
||
24 | protected $cluster; |
||
25 | |||
26 | /** |
||
27 | * The Cassandra connection handler. |
||
28 | * |
||
29 | * @var \Cassandra\Session |
||
30 | */ |
||
31 | protected $session; |
||
32 | |||
33 | /** |
||
34 | * The config |
||
35 | * |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $config; |
||
39 | |||
40 | /** |
||
41 | * Create a new database connection instance. |
||
42 | * |
||
43 | * @param array $config |
||
44 | */ |
||
45 | public function __construct(array $config) |
||
68 | |||
69 | /** |
||
70 | * Begin a fluent query against a database table. |
||
71 | * |
||
72 | * @param string $table |
||
73 | * @return Query\Builder |
||
74 | */ |
||
75 | public function table($table) |
||
83 | |||
84 | /** |
||
85 | * return Cassandra cluster. |
||
86 | * |
||
87 | * @return \Cassandra\Cluster |
||
88 | */ |
||
89 | public function getCassandraCluster() |
||
93 | |||
94 | /** |
||
95 | * return Cassandra Session. |
||
96 | * |
||
97 | * @return \Cassandra\Session |
||
98 | */ |
||
99 | public function getCassandraSession() |
||
103 | |||
104 | /** |
||
105 | * Return the Cassandra keyspace |
||
106 | * |
||
107 | * @return string |
||
108 | */ |
||
109 | public function getKeyspace() |
||
113 | |||
114 | /** |
||
115 | * Create a new Cassandra cluster object. |
||
116 | * |
||
117 | * @param array $config |
||
118 | * |
||
119 | * @return \Cassandra\Cluster |
||
120 | */ |
||
121 | protected function createCluster(array $config) |
||
171 | |||
172 | /** |
||
173 | * Disconnect from the underlying Cassandra connection. |
||
174 | */ |
||
175 | public function disconnect() |
||
179 | |||
180 | /** |
||
181 | * Get the PDO driver name. |
||
182 | * |
||
183 | * @return string |
||
184 | */ |
||
185 | public function getDriverName() |
||
189 | |||
190 | /** |
||
191 | * Run a select statement against the database. |
||
192 | * |
||
193 | * @param string $query |
||
194 | * @param array $bindings |
||
195 | * @param bool $useReadPdo |
||
196 | * @param array $customOptions |
||
197 | * |
||
198 | * @return array |
||
199 | */ |
||
200 | public function select($query, $bindings = [], $useReadPdo = true, array $customOptions = []) |
||
204 | |||
205 | /** |
||
206 | * Run an bulk insert statement against the database. |
||
207 | * |
||
208 | * @param array $queries |
||
209 | * @param array $bindings |
||
210 | * @param int $type |
||
211 | * @param array $customOptions |
||
212 | * |
||
213 | * @return bool |
||
214 | */ |
||
215 | public function insertBulk($queries = [], $bindings = [], $type = Cassandra::BATCH_LOGGED, array $customOptions = []) |
||
219 | |||
220 | /** |
||
221 | * Execute a group of queries inside a batch statement against the database. |
||
222 | * |
||
223 | * @param array $queries |
||
224 | * @param array $bindings |
||
225 | * @param int $type |
||
226 | * @param array $customOptions |
||
227 | * |
||
228 | * @return bool |
||
229 | */ |
||
230 | public function batchStatement($queries = [], $bindings = [], $type = Cassandra::BATCH_LOGGED, array $customOptions = []) |
||
247 | |||
248 | /** |
||
249 | * Execute an CQL statement and return the boolean result. |
||
250 | * |
||
251 | * @param string $query |
||
252 | * @param array $bindings |
||
253 | * @param array $customOptions |
||
254 | * |
||
255 | * @return bool |
||
256 | */ |
||
257 | public function statement($query, $bindings = [], array $customOptions = []) |
||
261 | |||
262 | /** |
||
263 | * Because Cassandra is an eventually consistent database, it's not possible to obtain |
||
264 | * the affected count for statements so we're just going to return 0, based on the idea |
||
265 | * that if the query fails somehow, an exception will be thrown |
||
266 | * |
||
267 | * @param string $query |
||
268 | * @param array $bindings |
||
269 | * @param array $customOptions |
||
270 | * |
||
271 | * @return int |
||
272 | */ |
||
273 | public function affectingStatement($query, $bindings = [], array $customOptions = []) |
||
277 | |||
278 | /** |
||
279 | * @inheritdoc |
||
280 | */ |
||
281 | protected function getDefaultPostProcessor() |
||
285 | |||
286 | /** |
||
287 | * @inheritdoc |
||
288 | */ |
||
289 | protected function getDefaultQueryGrammar() |
||
293 | |||
294 | /** |
||
295 | * @inheritdoc |
||
296 | */ |
||
297 | protected function getDefaultSchemaGrammar() |
||
301 | |||
302 | /** |
||
303 | * Reconnect to the database if connection is missing. |
||
304 | * |
||
305 | * @return void |
||
306 | */ |
||
307 | protected function reconnectIfMissingConnection() |
||
313 | |||
314 | /** |
||
315 | * Dynamically pass methods to the connection. |
||
316 | * |
||
317 | * @param string $method |
||
318 | * @param array $parameters |
||
319 | * @return mixed |
||
320 | */ |
||
321 | public function __call($method, $parameters) |
||
325 | |||
326 | /** |
||
327 | * Execute an CQL statement and return the boolean result. |
||
328 | * |
||
329 | * @param string $query |
||
330 | * @param array $bindings |
||
331 | * @param array $customOptions |
||
332 | * @param mixed $defaultFailed |
||
333 | * @param mixed $defaultSuccess |
||
334 | * |
||
335 | * @return mixed |
||
336 | */ |
||
337 | protected function runStatement($query, $bindings = [], array $customOptions = [], $defaultFailed = [], $defaultSuccess = null) |
||
354 | } |
||
355 |
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: