mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
API Use mysql-safe table namespace separator
This commit is contained in:
parent
d91c6659be
commit
1186f07830
@ -24,12 +24,10 @@ class DataObjectSchema
|
||||
* Default separate for table namespaces. Can be set to any string for
|
||||
* databases that do not support some characters.
|
||||
*
|
||||
* Defaults to \ to to conform to 3.x convention.
|
||||
*
|
||||
* @config
|
||||
* @var string
|
||||
*/
|
||||
private static $table_namespace_separator = '\\';
|
||||
private static $table_namespace_separator = '_';
|
||||
|
||||
/**
|
||||
* Cache of database fields
|
||||
|
@ -9,6 +9,7 @@ use SilverStripe\ORM\DataObjectSchema;
|
||||
use SilverStripe\ORM\Tests\DataObjectSchemaTest\BaseClass;
|
||||
use SilverStripe\ORM\Tests\DataObjectSchemaTest\BaseDataClass;
|
||||
use SilverStripe\ORM\Tests\DataObjectSchemaTest\ChildClass;
|
||||
use SilverStripe\ORM\Tests\DataObjectSchemaTest\DefaultTableName;
|
||||
use SilverStripe\ORM\Tests\DataObjectSchemaTest\GrandChildClass;
|
||||
use SilverStripe\ORM\Tests\DataObjectSchemaTest\HasFields;
|
||||
use SilverStripe\ORM\Tests\DataObjectSchemaTest\NoFields;
|
||||
@ -31,7 +32,8 @@ class DataObjectSchemaTest extends SapphireTest
|
||||
HasFields::Class,
|
||||
NoFields::class,
|
||||
WithCustomTable::class,
|
||||
WithRelation::class
|
||||
WithRelation::class,
|
||||
DefaultTableName::class
|
||||
);
|
||||
|
||||
/**
|
||||
@ -49,6 +51,11 @@ class DataObjectSchemaTest extends SapphireTest
|
||||
'DOSTWithCustomTable',
|
||||
$schema->tableName(WithCustomTable::class)
|
||||
);
|
||||
// Default table name is FQN
|
||||
$this->assertEquals(
|
||||
'SilverStripe_ORM_Tests_DataObjectSchemaTest_DefaultTableName',
|
||||
$schema->tableName(DefaultTableName::class)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
14
tests/php/ORM/DataObjectSchemaTest/DefaultTableName.php
Normal file
14
tests/php/ORM/DataObjectSchemaTest/DefaultTableName.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace SilverStripe\ORM\Tests\DataObjectSchemaTest;
|
||||
|
||||
use SilverStripe\Dev\TestOnly;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
|
||||
class DefaultTableName extends DataObject implements TestOnly
|
||||
{
|
||||
private static $db = [
|
||||
'Title' => 'Varchar',
|
||||
];
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user