简体   繁体   中英

How to define decimal data type for fixtures in Cakephp2.x?

I am creating a fixture for testing in cakephp2.x. I want to define the field type as a decimal, which is straightforward. However, I want to define it specifically with DECIMAL(6,4) , but cannot figure out how to set the digits.

I can't find it in the cookbook either: https://book.cakephp.org/2/en/development/testing.html

Any help would be appreciated!

You can specify both in the column definitions length option, like so:

public $fields = array(
    'column_name' => array(
        'type' => 'decimal',
        'length' => '6,4',
        'null' => false,
    ),
    // ...
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM