2023-03-01 15:19:07 +13:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\ORM\Tests\DBFieldTest;
|
|
|
|
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
use SilverStripe\ORM\DataObject;
|
|
|
|
|
|
|
|
class TestDataObject extends DataObject implements TestOnly
|
|
|
|
{
|
|
|
|
private static $table_name = 'DBFieldTest_TestDataObject';
|
|
|
|
|
|
|
|
private static $db = [
|
|
|
|
'Title' => TestDbField::class,
|
|
|
|
'MyTestField' => TestDbField::class,
|
|
|
|
];
|
|
|
|
|
|
|
|
public $setFieldCalledCount = 0;
|
|
|
|
|
2024-08-28 10:54:31 +12:00
|
|
|
public function setField(string $fieldName, mixed $value): static
|
2023-03-01 15:19:07 +13:00
|
|
|
{
|
|
|
|
$this->setFieldCalledCount++;
|
2024-08-28 10:54:31 +12:00
|
|
|
return parent::setField($fieldName, $value);
|
2023-03-01 15:19:07 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
public function setMyTestField($val)
|
|
|
|
{
|
|
|
|
return $this->setField('MyTestField', strtolower($val));
|
|
|
|
}
|
|
|
|
}
|