diff --git a/core/model/Translatable.php b/core/model/Translatable.php index fe9e1d42a..172ec2b47 100755 --- a/core/model/Translatable.php +++ b/core/model/Translatable.php @@ -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, diff --git a/security/Member.php b/security/Member.php index 917a2a138..f317d122f 100755 --- a/security/Member.php +++ b/security/Member.php @@ -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)', diff --git a/tests/DataObjectTest.php b/tests/DataObjectTest.php index dbdcd2d01..a48b3d874 100755 --- a/tests/DataObjectTest.php +++ b/tests/DataObjectTest.php @@ -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';