Can't have two conditions (sqlLiteral) with same argument(s)
Notice: This thread is very old.
- genesiscz
- Member | 21
Code:
<?php
$table = $database->table("table");
$table->where(new SqlLiteral("DATE(start) >= ?"), "2014-10-10");
$table->where(new SqlLiteral("DATE(start) <= ?"), "2014-10-10");
This searchs only for the first conditional.
Reason:
SqlBuilder.php around line 137:
$hash = md5(json_encode($args));
if (isset($this->conditions[$hash])) {
return FALSE;
}
the problem is that $args[0] has SqlLiteral which is encoded to blank object
if ($args[0] instanceof \Nette\Database\SqlLiteral) {
dump($args);
dump(json_encode($args));
die();
}
results in:
array(2) [
0 => Nette\Database\SqlLiteral(1) {
value private => "DATE(start) >= ?" (16)
}
1 => "2014-10-10" (10)
]
"[{},"2014-10-10"]" (17)
Problem:
Any SqlLiteral is encoded to an empty object in any case, so we need to find
another way of hashing arguments.
Last edited by genesiscz (2014-01-15 19:43)