mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
e2e32317d6
Also rename ViewableData to ModelData ahead of the template layer lift-and-shift
44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\ORM\Tests\DBFieldTest;
|
|
|
|
use SilverStripe\Core\Config\Config;
|
|
use SilverStripe\Dev\TestOnly;
|
|
use SilverStripe\ORM\DB;
|
|
use SilverStripe\ORM\FieldType\DBField;
|
|
use SilverStripe\Model\ModelData;
|
|
|
|
class TestDbField extends DBField implements TestOnly
|
|
{
|
|
public function requireField(): void
|
|
{
|
|
// Basically the same as DBVarchar but we don't want to test with DBVarchar in case something
|
|
// changes in that class eventually.
|
|
$charset = Config::inst()->get(MySQLDatabase::class, 'charset');
|
|
$collation = Config::inst()->get(MySQLDatabase::class, 'collation');
|
|
|
|
$parts = [
|
|
'datatype' => 'varchar',
|
|
'precision' => 255,
|
|
'character set' => $charset,
|
|
'collate' => $collation,
|
|
'arrayValue' => $this->arrayValue
|
|
];
|
|
|
|
$values = [
|
|
'type' => 'varchar',
|
|
'parts' => $parts
|
|
];
|
|
|
|
DB::require_field($this->tableName, $this->name, $values);
|
|
}
|
|
|
|
public $saveIntoCalledCount = 0;
|
|
|
|
public function saveInto(ModelData $model): void
|
|
{
|
|
$this->saveIntoCalledCount++;
|
|
parent::saveInto($model);
|
|
}
|
|
}
|