2016-10-14 03:30:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\ORM\Tests\DataExtensionTest;
|
|
|
|
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
use SilverStripe\ORM\DataExtension;
|
|
|
|
|
2017-07-03 02:21:27 +02:00
|
|
|
/**
|
|
|
|
* @skipUpgrade
|
|
|
|
*/
|
2016-10-14 03:30:05 +02:00
|
|
|
class PlayerExtension extends DataExtension implements TestOnly
|
|
|
|
{
|
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public static function get_extra_config($class = null, $extensionClass = null, $args = null)
|
|
|
|
{
|
2020-04-20 19:58:09 +02:00
|
|
|
$config = [];
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
// Only add these extensions if the $class is set to DataExtensionTest_Player, to
|
|
|
|
// test that the argument works.
|
2017-02-22 04:15:08 +01:00
|
|
|
if (strcasecmp($class, Player::class) === 0) {
|
2020-04-20 19:58:09 +02:00
|
|
|
$config['db'] = [
|
2016-12-16 05:34:21 +01:00
|
|
|
'Address' => 'Text',
|
|
|
|
'DateBirth' => 'Date',
|
|
|
|
'Status' => "Enum('Shooter,Goalie')"
|
2020-04-20 19:58:09 +02:00
|
|
|
];
|
|
|
|
$config['defaults'] = [
|
2016-12-16 05:34:21 +01:00
|
|
|
'Status' => 'Goalie'
|
2020-04-20 19:58:09 +02:00
|
|
|
];
|
2016-12-16 05:34:21 +01:00
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
return $config;
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
}
|