Money Vs Cactiverecord Issue

Hello,

I’m working on a report, and I’m getting a weird issue.

The Scenario:

I’m using mysql

I have a model, with a field amount (decimal 19,4)

In the database the field value is 36000.0000

The field was generated though migration, with type ‘money’

The model is a default one, generated trough gii.

However when I loop trough the data, the amount gets messed up.




$totalAmount = 0;


$dataProvider = new CActiveDataProvider('MyModel', array('pagination' => false));


foreach ($dataProvider->getData() as $data) {

    echo $data->amount; //returns 36000

    echo (float)$data->amount; //returns 36

    echo Yii::app()->getNumberFormatter()->formatCurrency($data->amount, ''); //returns 36.00


    $totalAmount = $totalAmount + $data->amount;

}


echo $totalAmount; //returns 36



Any ideas?

Problem solved, a behavior was causing the issue.

Close please.