Skip to content

Commit

Permalink
Update DataTablesComponent.php
Browse files Browse the repository at this point in the history
Verificando o tipo da coluna se é númerica para fazer o devido cast para validar a pesquisa
  • Loading branch information
Jefferson Simão Gonçalves committed Oct 15, 2019
1 parent 0a4c70c commit 3ed81c4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Controller/Component/DataTablesComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,30 @@ private function _addCondition($column, $value, $type = 'and')
$column = substr($column, $pos + 1);
}

$columnDesc = $table->getSchema()->getColumn($column);
$columnType = $columnDesc['type'];
if ($columnType !== 'string' && $columnType !== 'text') {
try {
switch ($columnType) {
case "tinyinteger":
case "smallinteger":
case "integer":
case "biginteger":
$value = intval($value);
break;
case "decimal":
case "float":
$value = floatval($value);
break;
}
if ($value === null) {
return;
}
} catch (\Exception $e) {
return;
}
}

$textCast = "";

/* build condition */
Expand Down

0 comments on commit 3ed81c4

Please sign in to comment.