I got a table with a varchar(255) column named "value" where i can store numbers and text, in some point of my web application i need to do some comparissions, and when i try to compare an integer value not always got the right result, my code looks:
$c->getNewCriterion(MyTablePeer::VALUE, $filter, Criteria::GREATER_THAN);
Example:
MyTable.value = 6
$filter = 5
works great, fil, but if $filter = 10 or greater dont work properly,
think need to cast column value to integer so i could make a right comparision, it's my question, how can i cast using propel ?
$c->getNewCriterion(MyTablePeer::VALUE, $filter, Criteria::GREATER_THAN);
Thanks
Try
$c->getNewCriterion(MyTablePeer::VALUE, 'CAST('. MyTablePeer::VALUE .' AS SIGNED) > '. $filter, Criteria::CUSTOM);