Merge branch '4.13' into 4

This commit is contained in:
github-actions 2023-08-26 14:23:30 +00:00
commit da1f74ea5b
4 changed files with 20 additions and 2 deletions

View File

@ -258,7 +258,9 @@ en:
db_CanEditType: 'Can edit type'
db_CanViewType: 'Can view type'
many_many_EditorGroups: 'Editor groups'
many_many_EditorMembers: 'Editor members'
many_many_ViewerGroups: 'Viewer groups'
many_many_ViewerMembers: 'Viewer members'
SilverStripe\Security\LoginAttempt:
Email: 'Email Address'
EmailHashed: 'Email Address (hashed)'

View File

@ -87,7 +87,8 @@ class ManyManyThroughList extends RelationList
if ($joinRow) {
$joinClass = $this->manipulator->getJoinClass();
$joinQueryParams = $this->manipulator->extractInheritableQueryParameters($this->dataQuery);
$joinRecord = Injector::inst()->create($joinClass, $joinRow, false, $joinQueryParams);
$creationType = empty($joinRow['ID']) ? DataObject::CREATE_OBJECT : DataObject::CREATE_HYDRATED;
$joinRecord = Injector::inst()->create($joinClass, $joinRow, $creationType, $joinQueryParams);
$record->setJoin($joinRecord, $joinAlias);
}

View File

@ -11,7 +11,7 @@ use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Form;
use SilverStripe\ORM\Connect\MySQLDatabase;
class CheckboxSetFieldMulitEnumTest extends SapphireTest
class CheckboxSetFieldMultiEnumTest extends SapphireTest
{
protected $usesDatabase = true;

View File

@ -514,4 +514,19 @@ class ManyManyThroughListTest extends SapphireTest
$relation->removeAll();
$this->assertEquals(sort($remove), sort($removedIds));
}
public function testChangedFields()
{
/** @var ManyManyThroughListTest\TestObject $parent */
$parent = $this->objFromFixture(ManyManyThroughListTest\TestObject::class, 'parent1');
$item1 = $parent->Items()->first();
// Nothing has changed yet
$this->assertEmpty($item1->getChangedFields());
$this->assertFalse($item1->isChanged('Title'));
// Change a field, ensure change is flagged
$item1->Title = 'a test title';
$this->assertTrue($item1->isChanged('Title'));
}
}