silverstripe-framework/tests/php/ORM/DataExtensionTest/PlayerExtension.php

31 lines
818 B
PHP
Raw Normal View History

2016-10-14 03:30:05 +02:00
<?php
namespace SilverStripe\ORM\Tests\DataExtensionTest;
use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataExtension;
class PlayerExtension extends DataExtension implements TestOnly
{
public static function get_extra_config($class = null, $extensionClass = null, $args = null)
{
$config = [];
2016-10-14 03:30:05 +02:00
// Only add these extensions if the $class is set to DataExtensionTest_Player, to
// test that the argument works.
2022-04-14 03:12:59 +02:00
if (strcasecmp($class ?? '', Player::class) === 0) {
$config['db'] = [
'Address' => 'Text',
'DateBirth' => 'Date',
'Status' => "Enum('Shooter,Goalie')"
];
$config['defaults'] = [
'Status' => 'Goalie'
];
}
2016-10-14 03:30:05 +02:00
return $config;
}
2016-10-14 03:30:05 +02:00
}