MINOR Reduced VARCHAR length from 1024 to 40 bytes, which fits the sha1 hashes created by RandomGenerator. 1024 bytes caused problems with index lengths on MySQL (from r114743)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@114744 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-12-09 05:49:21 +00:00 committed by Sam Minnee
parent e73e15d6c8
commit 7280a64d6b
3 changed files with 21 additions and 3 deletions

View File

@ -1154,6 +1154,7 @@ class Translatable extends DataObjectDecorator implements PermissionProvider {
$newTranslation = new $class;
// copy all fields from owner (apart from ID)
var_dump($this->owner->toMap());
$newTranslation->update($this->owner->toMap());
// If the object has Hierarchy extension,

View File

@ -11,18 +11,18 @@ class Member extends DataObject {
'Surname' => 'Varchar',
'Email' => 'Varchar',
'Password' => 'Varchar(160)',
'RememberLoginToken' => 'Varchar(1024)',
'RememberLoginToken' => 'Varchar(40)',
'NumVisit' => 'Int',
'LastVisited' => 'SS_Datetime',
'Bounced' => 'Boolean', // Note: This does not seem to be used anywhere.
'AutoLoginHash' => 'Varchar(1024)',
'AutoLoginHash' => 'Varchar(40)',
'AutoLoginExpired' => 'SS_Datetime',
// This is an arbitrary code pointing to a PasswordEncryptor instance,
// not an actual encryption algorithm.
// Warning: Never change this field after its the first password hashing without
// providing a new cleartext password as well.
'PasswordEncryption' => "Varchar(50)",
'Salt' => 'Varchar(50)',
'Salt' => 'Varchar(40)',
'PasswordExpiry' => 'Date',
'LockedOutUntil' => 'SS_Datetime',
'Locale' => 'Varchar(6)',

View File

@ -4,6 +4,23 @@
* @subpackage tests
*/
class DataObjectTest extends SapphireTest {
function testToMap() {
$obj = $this->objFromFixture('DataObjectTest_SubTeam', 'subteam1');
$map = $obj->toMap();
$this->assertArrayHasKey('ID', $map, 'Contains base fields');
$this->assertArrayHasKey('Title', $map, 'Contains fields from parent class');
$this->assertArrayHasKey('SubclassDatabaseField', $map, 'Contains fields from concrete class');
$this->assertEquals($obj->ID, $map['ID'], 'Contains values from base fields');
$this->assertEquals($obj->Title, $map['Title'], 'Contains values from parent class fields');
$this->assertEquals($obj->SubclassDatabaseField, $map['SubclassDatabaseField'], 'Contains values from concrete class fields');
$newObj = new DataObjectTest_SubTeam();
$this->assertArrayHasKey('Title', $map, 'Contains null fields');
}
static $fixture_file = 'sapphire/tests/DataObjectTest.yml';