From 3e72f5e6946b00301f326cee2f6b63fece0e2081 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Mon, 21 Aug 2023 12:32:21 +1200 Subject: [PATCH 1/3] ENH Update translations (#10920) --- lang/en.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lang/en.yml b/lang/en.yml index b2a60c947..9eecf2ddc 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -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)' From 57cb55d6ae8038ed7c919c210096a1eb4102861a Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Mon, 21 Aug 2023 15:49:09 +0100 Subject: [PATCH 2/3] FIX: Typo in CheckboxSetFieldMultiEnumTest class name (closes #10689) --- tests/php/Forms/CheckboxSetFieldMultiEnumTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/php/Forms/CheckboxSetFieldMultiEnumTest.php b/tests/php/Forms/CheckboxSetFieldMultiEnumTest.php index 13c5c4238..47095982b 100644 --- a/tests/php/Forms/CheckboxSetFieldMultiEnumTest.php +++ b/tests/php/Forms/CheckboxSetFieldMultiEnumTest.php @@ -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; From 1fd495449b80c13b06b0ea60620208b66617eee0 Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Mon, 21 Aug 2023 15:46:05 +0100 Subject: [PATCH 3/3] FIX: Stop ManyManyThroughList join records incorrectly showing as changed (fixes #10821) --- src/ORM/ManyManyThroughList.php | 3 ++- tests/php/ORM/ManyManyThroughListTest.php | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/ORM/ManyManyThroughList.php b/src/ORM/ManyManyThroughList.php index 6bd5050a0..a78d317ba 100644 --- a/src/ORM/ManyManyThroughList.php +++ b/src/ORM/ManyManyThroughList.php @@ -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); } diff --git a/tests/php/ORM/ManyManyThroughListTest.php b/tests/php/ORM/ManyManyThroughListTest.php index 26211d7c2..acb2bb4cc 100644 --- a/tests/php/ORM/ManyManyThroughListTest.php +++ b/tests/php/ORM/ManyManyThroughListTest.php @@ -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')); + } }