Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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

Error show: Column type does not support scale parameter



2.4k
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.



3.3k
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.