silverstripe-framework/tests/php/ORM/DatabaseTest/MyObject.php
Sam Minnee 0111b98b18 FIX: Ensure that types are preserved fetching from database
This ensures that numeric fields appear in PHP as int/float values
rather than strings, which allows the development of more type-safe PHP
code.

This doesn’t work on the legacy mysql driver and this will now throw
a notice-level error. It requires mysqlnd.
2018-11-09 10:31:19 +13:00

22 lines
541 B
PHP

<?php
namespace SilverStripe\ORM\Tests\DatabaseTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\Connect\MySQLSchemaManager;
use SilverStripe\ORM\DataObject;
class MyObject extends DataObject implements TestOnly
{
private static $table_name = 'DatabaseTest_MyObject';
private static $create_table_options = array(MySQLSchemaManager::ID => 'ENGINE=InnoDB');
private static $db = array(
'MyField' => 'Varchar',
'MyInt' => 'Int',
'MyFloat' => 'Float',
'MyBoolean' => 'Boolean',
);
}