<![CDATA[ xPDO doesn't take floats? - My Forums]]> https://forums.modx.com/thread/?thread=85069 <![CDATA[Re: xPDO doesn't take floats?]]> https://forums.modx.com/thread/85069/xpdo-doesn-t-take-floats#dis-post-469304 Quote from: opengeek at Jun 16, 2013, 02:59 PM
What is the dbtype and phptype of the column in your schema?
<object class="Flat" table="flat" extends="xPDOSimpleObject">
    ...
    <field key="price" dbtype="decimal" precision="7,2" phptype="float" null="false" />
</object>
Quote from: opengeek at Jun 16, 2013, 02:59 PM
Could possibly be this...

http://tracker.modx.com/issues/7452
Maybe it really has something to do with number format / locale. I'll look into that, thank you.]]>
localhot Jun 17, 2013, 10:39 PM https://forums.modx.com/thread/85069/xpdo-doesn-t-take-floats#dis-post-469304
<![CDATA[Re: xPDO doesn't take floats?]]> https://forums.modx.com/thread/85069/xpdo-doesn-t-take-floats#dis-post-469208
Could possibly be this...

http://tracker.modx.com/issues/7452



]]>
opengeek Jun 16, 2013, 02:59 PM https://forums.modx.com/thread/85069/xpdo-doesn-t-take-floats#dis-post-469208
<![CDATA[xPDO doesn't take floats?]]> https://forums.modx.com/thread/85069/xpdo-doesn-t-take-floats#dis-post-469172 The line
$query->where(array('price:>=' => 4));

works fine, but when I change it to
$query->where(array('price:>=' => 4.25));

I get the following message in the error log:
[2013-06-15 22:22:43] (ERROR @ /index.php) Error 21000 executing query: SELECT [...] WHERE  ( `Flat`.`status` >= ? AND `Flat`.`price` >= ? )  ORDER BY areaTotal ASC, `Flat`.`id` ASC  - Array
(
    [0] => 21000
    [1] => 1241
    [2] => Operand should contain 1 column(s)
)

Question marks instead of values and an extra ORDER BY (`Flat`.`id`) in the log, while the SQL produced by
$query->prepare();
print $query->toSQL();

prints
... WHERE ( `Flat`.`status` >= 1 AND `Flat`.`price` >= 4 ) ORDER BY areaTotal ASC

with 4.25 truncated to 4.

MODX 2.2.6
PHP 5.2.17]]>
localhot Jun 15, 2013, 11:22 PM https://forums.modx.com/thread/85069/xpdo-doesn-t-take-floats#dis-post-469172