2016-10-14 14:30:05 +13:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\ORM\Tests\DataObjectTest;
|
|
|
|
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
use SilverStripe\ORM\DataObject;
|
|
|
|
|
|
|
|
class Fixture extends DataObject implements TestOnly
|
|
|
|
{
|
2016-12-16 17:34:21 +13:00
|
|
|
private static $table_name = 'DataObjectTest_Fixture';
|
2016-10-14 14:30:05 +13:00
|
|
|
|
2020-04-20 18:58:09 +01:00
|
|
|
private static $db = [
|
2016-12-16 17:34:21 +13:00
|
|
|
// Funny field names
|
|
|
|
'Data' => 'Varchar',
|
|
|
|
'Duplicate' => 'Varchar',
|
|
|
|
'DbObject' => 'Varchar',
|
2016-10-14 14:30:05 +13:00
|
|
|
|
2016-12-16 17:34:21 +13:00
|
|
|
// Field types
|
|
|
|
'DateField' => 'Date',
|
|
|
|
'DatetimeField' => 'Datetime',
|
2016-10-14 14:30:05 +13:00
|
|
|
|
2016-12-16 17:34:21 +13:00
|
|
|
'MyFieldWithDefault' => 'Varchar',
|
2018-11-10 12:25:16 +13:00
|
|
|
'MyFieldWithAltDefault' => 'Varchar',
|
|
|
|
|
|
|
|
'MyInt' => 'Int',
|
|
|
|
'MyCurrency' => 'Currency',
|
|
|
|
'MyDecimal'=> 'Decimal',
|
2021-07-01 16:00:08 +12:00
|
|
|
|
|
|
|
// Enums
|
|
|
|
'MyEnum' => 'Enum("25,50,75,100", "50")',
|
|
|
|
'MyEnumWithDots' => 'Enum("25.25,50.00,75.00,100.50", "50.00")',
|
2020-04-20 18:58:09 +01:00
|
|
|
];
|
2016-10-14 14:30:05 +13:00
|
|
|
|
2020-04-20 18:58:09 +01:00
|
|
|
private static $defaults = [
|
2016-12-16 17:34:21 +13:00
|
|
|
'MyFieldWithDefault' => 'Default Value',
|
2020-04-20 18:58:09 +01:00
|
|
|
];
|
2016-10-14 14:30:05 +13:00
|
|
|
|
2020-04-20 18:58:09 +01:00
|
|
|
private static $summary_fields = [
|
2016-12-16 17:34:21 +13:00
|
|
|
'Data' => 'Data',
|
|
|
|
'DateField.Nice' => 'Date'
|
2020-04-20 18:58:09 +01:00
|
|
|
];
|
2016-10-14 14:30:05 +13:00
|
|
|
|
2020-04-20 18:58:09 +01:00
|
|
|
private static $searchable_fields = [];
|
2016-10-14 14:30:05 +13:00
|
|
|
|
2016-12-16 17:34:21 +13:00
|
|
|
public function populateDefaults()
|
|
|
|
{
|
|
|
|
parent::populateDefaults();
|
2016-10-14 14:30:05 +13:00
|
|
|
|
2016-12-16 17:34:21 +13:00
|
|
|
$this->MyFieldWithAltDefault = 'Default Value';
|
|
|
|
}
|
2016-10-14 14:30:05 +13:00
|
|
|
}
|