We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

[2.0] Can not create models if field is double from dev-tool

Error show: Column type does not support scale parameter



4.7k
edited Apr '15

Have a look at this section.

They used decimal for the database and cast it to a double in the getter method

public function getPrice()
{
    //Convert the value to double before be used
    return (double) $this->price;
}
mysql> desc products;
+------------------+------------------+------+-----+---------+----------------+
| Field            | Type             | Null | Key | Default | Extra          |
+------------------+------------------+------+-----+---------+----------------+
| id               | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| product_types_id | int(10) unsigned | NO   | MUL | NULL    |                |
| name             | varchar(70)      | NO   |     | NULL    |                |
| price            | decimal(16,2)    | NO   |     | NULL    |                |
| active           | char(1)          | YES  |     | NULL    |                |
+------------------+------------------+------+-----+---------+----------------+
5 rows in set (0.00 sec)

I'm not sure if this answeres your question. It would be great if you could explain your problem a little more in detail.



5.4k
Accepted
answer

That's a bug of 2.0. It will be fixed in 2.0.x.

In dev-tool 2.0.1, this bug still happen.