diff --git a/src/Forms/Form.php b/src/Forms/Form.php index 3f0dfe2004f..7c540210bc2 100644 --- a/src/Forms/Form.php +++ b/src/Forms/Form.php @@ -20,8 +20,8 @@ use SilverStripe\View\AttributesHTML; use SilverStripe\View\SSViewer; use SilverStripe\Model\ModelData; -use SilverStripe\Forms\Validation\RequiredFieldsValidator; use SilverStripe\Forms\Validation\Validator; +use SilverStripe\Dev\Deprecation; /** * Base class for all forms. @@ -1247,6 +1247,18 @@ public function getLegend() return $this->legend; } + /** + * Alias of validate() for backwards compatibility. + * + * @return ValidationResult + * @deprecated 5.4.0 Use validate() instead + */ + public function validationResult() + { + Deprecation::notice('5.4.0', 'Use validate() instead'); + return $this->validate(); + } + /** * Processing that occurs before a form is executed. * @@ -1258,13 +1270,10 @@ public function getLegend() * * Triggered through {@link httpSubmission()}. * - * * Note that CSRF protection takes place in {@link httpSubmission()}, * if it fails the form data will never reach this method. - * - * @return ValidationResult - */ - public function validationResult() + */ + public function validate(): ValidationResult { $result = ValidationResult::create(); // Automatically pass if the clicked button is exempt diff --git a/src/Forms/FormRequestHandler.php b/src/Forms/FormRequestHandler.php index d2125881116..b72df564d7e 100644 --- a/src/Forms/FormRequestHandler.php +++ b/src/Forms/FormRequestHandler.php @@ -216,7 +216,7 @@ public function httpSubmission($request) // Action handlers may throw ValidationExceptions. try { // Or we can use the Validator attached to the form - $result = $this->form->validationResult(); + $result = $this->form->validate(); if (!$result->isValid()) { return $this->getValidationErrorResponse($result); } diff --git a/src/ORM/DataList.php b/src/ORM/DataList.php index 0bb36d4e088..726ff93021e 100644 --- a/src/ORM/DataList.php +++ b/src/ORM/DataList.php @@ -1040,7 +1040,14 @@ private function fetchEagerLoadRelations(Query $query): void $parentIDs = $topLevelIDs; $parentRelationData = $query; $chainToDate = []; + $polymorphicEncountered = false; foreach (explode('.', $relationChain) as $relationName) { + if ($polymorphicEncountered) { + $polymorphicRelation = $chainToDate[array_key_last($chainToDate)]; + throw new InvalidArgumentException( + "Invalid relation passed to eagerLoad() - $relationChain. Further nested relations are not supported after polymorphic has_one relation $polymorphicRelation." + ); + } /** @var Query|array $parentRelationData */ $chainToDate[] = $relationName; list( @@ -1059,6 +1066,9 @@ private function fetchEagerLoadRelations(Query $query): void $relationName, $relationType ); + if ($relationComponent['joinClass']) { + $polymorphicEncountered = true; + } break; case 'belongs_to': list($parentRelationData, $parentIDs) = $this->fetchEagerLoadBelongsTo( @@ -1190,6 +1200,10 @@ private function fetchEagerLoadHasOne( // into the has_one components - DataObject does that for us in getComponent() without any extra // db calls. + // fetchEagerLoadRelations expects these to be flat arrays if the relation is not polymorphic + if (!$hasOneClassField) { + return [$fetchedRecords, $fetchedIDs[$relationDataClass] ?? []]; + } return [$fetchedRecords, $fetchedIDs]; } diff --git a/tests/php/Forms/CompositeValidatorTest.php b/tests/php/Forms/CompositeValidatorTest.php index da181e9bbd8..1a41615b410 100644 --- a/tests/php/Forms/CompositeValidatorTest.php +++ b/tests/php/Forms/CompositeValidatorTest.php @@ -165,7 +165,7 @@ public function testValidate(): void // Put data into the form so the validator can pull it back out again $form->loadDataFrom($data); - $result = $form->validationResult(); + $result = $form->validate(); $this->assertFalse($result->isValid()); $this->assertCount(2, $result->getMessages()); } @@ -187,14 +187,14 @@ public function testRemoveValidation(): void // Put data into the form so the validator can pull it back out again $form->loadDataFrom($data); - $result = $form->validationResult(); + $result = $form->validate(); $this->assertFalse($result->isValid()); $this->assertCount(1, $result->getMessages()); // Make sure it doesn't fail after removing validation AND has no errors (since calling validate should // reset errors) $compositeValidator->removeValidation(); - $result = $form->validationResult(); + $result = $form->validate(); $this->assertTrue($result->isValid()); $this->assertEmpty($result->getMessages()); } diff --git a/tests/php/Forms/FileFieldTest.php b/tests/php/Forms/FileFieldTest.php index aa863cf049d..914a310d819 100644 --- a/tests/php/Forms/FileFieldTest.php +++ b/tests/php/Forms/FileFieldTest.php @@ -36,7 +36,7 @@ public function testUploadRequiredFile() ]; $fileField->setValue($fileFieldValue); - $this->assertTrue($form->validationResult()->isValid()); + $this->assertTrue($form->validate()->isValid()); } /** @@ -139,7 +139,7 @@ public function testUploadMissingRequiredFile() $fileField->setValue($fileFieldValue); $this->assertFalse( - $form->validationResult()->isValid(), + $form->validate()->isValid(), 'An error occurred when uploading a file, but the validator returned true' ); @@ -148,7 +148,7 @@ public function testUploadMissingRequiredFile() $fileField->setValue($fileFieldValue); $this->assertFalse( - $form->validationResult()->isValid(), + $form->validate()->isValid(), 'An empty array was passed as parameter for an uploaded file, but the validator returned true' ); @@ -157,7 +157,7 @@ public function testUploadMissingRequiredFile() $fileField->setValue($fileFieldValue); $this->assertFalse( - $form->validationResult()->isValid(), + $form->validate()->isValid(), 'A null value was passed as parameter for an uploaded file, but the validator returned true' ); } diff --git a/tests/php/Forms/FormFieldTest.php b/tests/php/Forms/FormFieldTest.php index 4ccc0039400..6c8c27a24c7 100644 --- a/tests/php/Forms/FormFieldTest.php +++ b/tests/php/Forms/FormFieldTest.php @@ -534,7 +534,7 @@ public function testGetSchemaStateWithFormValidation() $field = new FormField('MyField', 'My Field'); $validator = new RequiredFieldsValidator('MyField'); $form = new Form(null, 'TestForm', new FieldList($field), new FieldList(), $validator); - $form->validationResult(); + $form->validate(); $schema = $field->getSchemaState(); $this->assertEquals( '"My Field" is required', @@ -566,10 +566,13 @@ public function testValidationExtensionHooks() $result = $field->validate(); $this->assertFalse($result->isValid()); - // Ensure messages set via updateValidate() propagate through after form validation - $result = $form->validationResult(); - $state = $field->getSchemaState(); - $this->assertEquals('A test error message', $state['message']['value']); + // Ensure messages set via updateValidationResult() propagate through to form fields after validation + $form->validate(); + $schema = $field->getSchemaState(); + $this->assertEquals( + 'A test error message', + $schema['message']['value'] + ); } public function testValidationExtensionHooksAreCalledOnFormFieldSubclasses() diff --git a/tests/php/Forms/FormSchemaTest.php b/tests/php/Forms/FormSchemaTest.php index 1cc3a46fbd6..c016fbda90f 100644 --- a/tests/php/Forms/FormSchemaTest.php +++ b/tests/php/Forms/FormSchemaTest.php @@ -149,7 +149,7 @@ public function testGetStateWithFieldValidationErrors() 'Title' => null, ] ); - $this->assertFalse($form->validationResult()->isValid()); + $this->assertFalse($form->validate()->isValid()); $formSchema = new FormSchema(); $expected = [ 'id' => 'Form_TestForm', diff --git a/tests/php/Forms/FormTest.php b/tests/php/Forms/FormTest.php index 7e30a1b5fe3..1deb7585dbc 100644 --- a/tests/php/Forms/FormTest.php +++ b/tests/php/Forms/FormTest.php @@ -406,7 +406,7 @@ public function testLookupFieldDisabledSaving() $form->saveInto($object); $playersIds = $object->Players()->getIDList(); - $this->assertTrue($form->validationResult()->isValid()); + $this->assertTrue($form->validate()->isValid()); $this->assertEquals( $playersIds, [], diff --git a/tests/php/Forms/GridField/GridFieldTest.php b/tests/php/Forms/GridField/GridFieldTest.php index 8847ee255f8..2b580961bea 100644 --- a/tests/php/Forms/GridField/GridFieldTest.php +++ b/tests/php/Forms/GridField/GridFieldTest.php @@ -542,7 +542,7 @@ public function testValidationMessageInOutput() $form = new Form(null, "testForm", $fieldList, new FieldList(), $validator); // A form that fails validation should display the validation error in the FieldHolder output. - $form->validationResult(); + $form->validate(); $gridfieldOutput = $gridField->FieldHolder(); $this->assertStringContainsString('

error

', $gridfieldOutput); @@ -552,7 +552,7 @@ public function testValidationMessageInOutput() // A form that passes validation should not display a validation error in the FieldHolder output. $form->setValidator(null); - $form->validationResult(); + $form->validate(); $gridfieldOutput = $gridField->FieldHolder(); $this->assertStringNotContainsString('

', $gridfieldOutput); } diff --git a/tests/php/Forms/OptionsetFieldTest.php b/tests/php/Forms/OptionsetFieldTest.php index 04c188d6e5c..679a6a7f882 100644 --- a/tests/php/Forms/OptionsetFieldTest.php +++ b/tests/php/Forms/OptionsetFieldTest.php @@ -60,8 +60,8 @@ public function testValidation() $field->setValue(''); $this->assertFalse($field->validate()->isValid()); - // ... and should not pass "RequiredFieldsValidator" validation - $this->assertFalse($form->validationResult()->isValid()); + // ... but should not pass "RequiredFields" validation + $this->assertFalse($form->validate()->isValid()); // null value should pass field-level validation... $field->setValue(null); diff --git a/tests/php/Forms/ValidatorTest.php b/tests/php/Forms/ValidatorTest.php index 941094b438f..56659a07797 100644 --- a/tests/php/Forms/ValidatorTest.php +++ b/tests/php/Forms/ValidatorTest.php @@ -45,13 +45,13 @@ public function testRemoveValidation() $form->setValidator($validator); // Setup validator now that we've got our form. $form->loadDataFrom($data); // Put data into the form so the validator can pull it back out again. - $result = $form->validationResult(); + $result = $form->validate(); $this->assertFalse($result->isValid()); $this->assertCount(1, $result->getMessages()); // Make sure it doesn't fail after removing validation AND has no errors (since calling validate should reset errors). $validator->removeValidation(); - $result = $form->validationResult(); + $result = $form->validate(); $this->assertTrue($result->isValid()); $this->assertEmpty($result->getMessages()); } diff --git a/tests/php/ORM/DataListEagerLoadingTest.php b/tests/php/ORM/DataListEagerLoadingTest.php index 9eb5a87fc7b..47cf6799f34 100644 --- a/tests/php/ORM/DataListEagerLoadingTest.php +++ b/tests/php/ORM/DataListEagerLoadingTest.php @@ -36,6 +36,9 @@ use SilverStripe\ORM\Tests\DataListTest\EagerLoading\BelongsManyManyEagerLoadObject; use SilverStripe\ORM\Tests\DataListTest\EagerLoading\BelongsManyManySubEagerLoadObject; use SilverStripe\ORM\Tests\DataListTest\EagerLoading\BelongsManyManySubSubEagerLoadObject; +use SilverStripe\ORM\Tests\DataListTest\EagerLoading\MixedBackwardsHasManyEagerLoadObject; +use SilverStripe\ORM\Tests\DataListTest\EagerLoading\MixedBackwardsHasOneEagerLoadObject; +use SilverStripe\ORM\Tests\DataListTest\EagerLoading\MixedBackwardsManyManyEagerLoadObject; use SilverStripe\ORM\Tests\DataListTest\EagerLoading\MixedHasManyEagerLoadObject; use SilverStripe\ORM\Tests\DataListTest\EagerLoading\MixedHasOneEagerLoadObject; use SilverStripe\ORM\Tests\DataListTest\EagerLoading\MixedManyManyEagerLoadObject; @@ -77,6 +80,9 @@ public static function getExtraDataObjects() MixedHasManyEagerLoadObject::class, MixedHasOneEagerLoadObject::class, MixedManyManyEagerLoadObject::class, + MixedBackwardsHasOneEagerLoadObject::class, + MixedBackwardsHasManyEagerLoadObject::class, + MixedBackwardsManyManyEagerLoadObject::class, ]; } @@ -188,154 +194,175 @@ public static function provideEagerLoadRelations(): array [ 'iden' => 'lazy-load', 'eagerLoad' => [], - 'expected' => 83 + 'expected' => 91 ], [ 'iden' => 'has-one-a', 'eagerLoad' => [ 'HasOneEagerLoadObject', ], - 'expected' => 82 + 'expected' => 90 ], [ 'iden' => 'has-one-b', 'eagerLoad' => [ 'HasOneEagerLoadObject.HasOneSubEagerLoadObject', ], - 'expected' => 81 + 'expected' => 89 ], [ 'iden' => 'has-one-c', 'eagerLoad' => [ 'HasOneEagerLoadObject.HasOneSubEagerLoadObject.HasOneSubSubEagerLoadObject', ], - 'expected' => 80 + 'expected' => 88 ], [ 'iden' => 'belongs-to-a', 'eagerLoad' => [ 'BelongsToEagerLoadObject', ], - 'expected' => 82 + 'expected' => 90 ], [ 'iden' => 'belongs-to-b', 'eagerLoad' => [ 'BelongsToEagerLoadObject.BelongsToSubEagerLoadObject', ], - 'expected' => 81 + 'expected' => 89 ], [ 'iden' => 'belongs-to-c', 'eagerLoad' => [ 'BelongsToEagerLoadObject.BelongsToSubEagerLoadObject.BelongsToSubSubEagerLoadObject', ], - 'expected' => 80 + 'expected' => 88 ], [ 'iden' => 'has-many-a', 'eagerLoad' => [ 'HasManyEagerLoadObjects', ], - 'expected' => 82 + 'expected' => 90 ], [ 'iden' => 'has-many-b', 'eagerLoad' => [ 'HasManyEagerLoadObjects.HasManySubEagerLoadObjects', ], - 'expected' => 79 + 'expected' => 87 ], [ 'iden' => 'has-many-c', 'eagerLoad' => [ 'HasManyEagerLoadObjects.HasManySubEagerLoadObjects.HasManySubSubEagerLoadObjects', ], - 'expected' => 72 + 'expected' => 80 ], [ 'iden' => 'many-many-a', 'eagerLoad' => [ 'ManyManyEagerLoadObjects', ], - 'expected' => 83 // same number as lazy-load, though without an INNER JOIN + 'expected' => 91 // same number as lazy-load, though without an INNER JOIN ], [ 'iden' => 'many-many-b', 'eagerLoad' => [ 'ManyManyEagerLoadObjects.ManyManySubEagerLoadObjects', ], - 'expected' => 81 + 'expected' => 89 ], [ 'iden' => 'many-many-c', 'eagerLoad' => [ 'ManyManyEagerLoadObjects.ManyManySubEagerLoadObjects.ManyManySubSubEagerLoadObjects', ], - 'expected' => 75 + 'expected' => 83 ], [ 'iden' => 'many-many-through-a', 'eagerLoad' => [ 'ManyManyThroughEagerLoadObjects', ], - 'expected' => 83 + 'expected' => 91 ], [ 'iden' => 'many-many-through-b', 'eagerLoad' => [ 'ManyManyThroughEagerLoadObjects.ManyManyThroughSubEagerLoadObjects', ], - 'expected' => 81 + 'expected' => 89 ], [ 'iden' => 'many-many-through-c', 'eagerLoad' => [ 'ManyManyThroughEagerLoadObjects.ManyManyThroughSubEagerLoadObjects.ManyManyThroughSubSubEagerLoadObjects', ], - 'expected' => 75 + 'expected' => 83 ], [ 'iden' => 'belongs-many-many-a', 'eagerLoad' => [ 'BelongsManyManyEagerLoadObjects', ], - 'expected' => 83 + 'expected' => 91 ], [ 'iden' => 'belongs-many-many-b', 'eagerLoad' => [ 'BelongsManyManyEagerLoadObjects.BelongsManyManySubEagerLoadObjects', ], - 'expected' => 81 + 'expected' => 89 ], [ 'iden' => 'belongs-many-many-c', 'eagerLoad' => [ 'BelongsManyManyEagerLoadObjects.BelongsManyManySubEagerLoadObjects.BelongsManyManySubSubEagerLoadObjects', ], - 'expected' => 75 + 'expected' => 83 ], [ 'iden' => 'mixed-a', 'eagerLoad' => [ 'MixedManyManyEagerLoadObjects', ], - 'expected' => 83 + 'expected' => 91 ], [ 'iden' => 'mixed-b', 'eagerLoad' => [ 'MixedManyManyEagerLoadObjects.MixedHasManyEagerLoadObjects', ], - 'expected' => 80 + 'expected' => 88 ], [ 'iden' => 'mixed-c', 'eagerLoad' => [ 'MixedManyManyEagerLoadObjects.MixedHasManyEagerLoadObjects.MixedHasOneEagerLoadObject', ], - 'expected' => 73 + 'expected' => 81 + ], + [ + 'iden' => 'mixed-back-a', + 'eagerLoad' => [ + 'MixedBackwardsHasOneEagerLoadObject', + ], + 'expected' => 90 + ], + [ + 'iden' => 'mixed-back-b', + 'eagerLoad' => [ + 'MixedBackwardsHasOneEagerLoadObject.MixedBackwardsHasManyEagerLoadObjects', + ], + 'expected' => 89 + ], + [ + 'iden' => 'mixed-back-c', + 'eagerLoad' => [ + 'MixedBackwardsHasOneEagerLoadObject.MixedBackwardsHasManyEagerLoadObjects.MixedBackwardsManyManyEagerLoadObjects', + ], + 'expected' => 87 ], [ 'iden' => 'duplicates', @@ -348,7 +375,7 @@ public static function provideEagerLoadRelations(): array 'BelongsManyManyEagerLoadObjects.BelongsManyManySubEagerLoadObjects', 'MixedManyManyEagerLoadObjects.MixedHasManyEagerLoadObjects.MixedHasOneEagerLoadObject', ], - 'expected' => 73 + 'expected' => 81 ], [ 'iden' => 'all', @@ -360,8 +387,9 @@ public static function provideEagerLoadRelations(): array 'ManyManyThroughEagerLoadObjects.ManyManyThroughSubEagerLoadObjects.ManyManyThroughSubSubEagerLoadObjects', 'BelongsManyManyEagerLoadObjects.BelongsManyManySubEagerLoadObjects.BelongsManyManySubSubEagerLoadObjects', 'MixedManyManyEagerLoadObjects.MixedHasManyEagerLoadObjects.MixedHasOneEagerLoadObject', + 'MixedBackwardsHasOneEagerLoadObject.MixedBackwardsHasManyEagerLoadObjects.MixedBackwardsManyManyEagerLoadObjects', ], - 'expected' => 32 + 'expected' => 36 ], ]; } @@ -442,6 +470,13 @@ private function expectedEagerLoadRelations(): array 'mixedHasOneObj 0 1 0 1', 'mixedHasManyObj 0 1 1', 'mixedHasOneObj 0 1 1 1', + 'mixedBackwardsHasOneObj 0', + 'mixedBackwardsHasManyObj 0 0', + 'mixedBackwardsManyManyObj 0 0 0', + 'mixedBackwardsManyManyObj 0 0 1', + 'mixedBackwardsHasManyObj 0 1', + 'mixedBackwardsManyManyObj 0 1 0', + 'mixedBackwardsManyManyObj 0 1 1', 'obj 1', 'hasOneObj 1', 'hasOneSubObj 1', @@ -515,6 +550,13 @@ private function expectedEagerLoadRelations(): array 'mixedHasOneObj 1 1 0 1', 'mixedHasManyObj 1 1 1', 'mixedHasOneObj 1 1 1 1', + 'mixedBackwardsHasOneObj 1', + 'mixedBackwardsHasManyObj 1 0', + 'mixedBackwardsManyManyObj 1 0 0', + 'mixedBackwardsManyManyObj 1 0 1', + 'mixedBackwardsHasManyObj 1 1', + 'mixedBackwardsManyManyObj 1 1 0', + 'mixedBackwardsManyManyObj 1 1 1', ]; } @@ -669,6 +711,25 @@ private function createEagerLoadData( } } } + $mixedBackwardsHasOneObj = new MixedBackwardsHasOneEagerLoadObject(); + $mixedBackwardsHasOneObj->Title = "mixedBackwardsHasOneObj $i"; + $mixedBackwardsHasOneObjID = $mixedBackwardsHasOneObj->write(); + + $obj->MixedBackwardsHasOneEagerLoadObjectID = $mixedBackwardsHasOneObjID; + $obj->write(); + + for ($j = 0; $j < $numLevel2Records; $j++) { + $mixedBackwardsHasManyObj = new MixedBackwardsHasManyEagerLoadObject(); + $mixedBackwardsHasManyObj->Title = "mixedBackwardsHasManyObj $i $j"; + $mixedBackwardsHasManyObj->MixedBackwardsHasOneEagerLoadObjectID = $mixedBackwardsHasOneObjID; + $mixedBackwardsHasManyObjID = $mixedBackwardsHasManyObj->write(); + $mixedBackwardsHasOneObj->MixedBackwardsHasManyEagerLoadObjects()->add($mixedBackwardsHasManyObj); + for ($k = 0; $k < $numLevel3Records; $k++) { + $mixedBackwardsManyManyObj = new MixedBackwardsManyManyEagerLoadObject(); + $mixedBackwardsManyManyObj->Title = "mixedBackwardsManyManyObj $i $j $k"; + $mixedBackwardsHasManyObj->MixedBackwardsManyManyEagerLoadObjects()->add($mixedBackwardsManyManyObj); + } + } } } @@ -747,6 +808,16 @@ private function iterateEagerLoadData(DataList $dataList, int $chunks = 0): arra $results[] = $mixedHasManyObj->MixedHasOneEagerLoadObject()->Title; } } + $mixedBackwardsHasOneObj = $obj->MixedBackwardsHasOneEagerLoadObject(); + if ($mixedBackwardsHasOneObj) { + $results[] = $mixedBackwardsHasOneObj->Title; + foreach ($mixedBackwardsHasOneObj->MixedBackwardsHasManyEagerLoadObjects() as $mixedBackwardsHasManyObj) { + $results[] = $mixedBackwardsHasManyObj->Title; + foreach ($mixedBackwardsHasManyObj->MixedBackwardsManyManyEagerLoadObjects() as $mixedBackwardsManyManyObj) { + $results[] = $mixedBackwardsManyManyObj->Title; + } + } + } } $selectCount = $this->stopCountingSelectQueries(); } finally { @@ -1691,6 +1762,17 @@ public function testPolymorphEagerLoading(): void $this->validateMultipleAppearance($items, 4, EagerLoadObject::get()->eagerLoad('HasOnePolymorphObject'), 'HasOnePolymorphObject'); } + /** + * Tests that attempting to eager load a sub relation to a polymorphic relation will throw an exception. + */ + public function testEagerLoadingSubRelationToPolymorphicException(): void + { + $items = $this->providePolymorphHasOne(); + $this->expectException(InvalidArgumentException::class); + $this->expectExceptionMessage("Invalid relation passed to eagerLoad() - HasOnePolymorphObject.ManyManySubEagerLoadObjects. Further nested relations are not supported after polymorphic has_one relation HasOnePolymorphObject."); + EagerLoadObject::get()->eagerLoad("HasOnePolymorphObject.ManyManySubEagerLoadObjects")->toArray(); + } + protected function providePolymorphHasOne(): array { $subA = new HasOneEagerLoadObject(); diff --git a/tests/php/ORM/DataListTest/EagerLoading/EagerLoadObject.php b/tests/php/ORM/DataListTest/EagerLoading/EagerLoadObject.php index 568d715204d..c0022b5dd86 100644 --- a/tests/php/ORM/DataListTest/EagerLoading/EagerLoadObject.php +++ b/tests/php/ORM/DataListTest/EagerLoading/EagerLoadObject.php @@ -16,6 +16,7 @@ class EagerLoadObject extends DataObject implements TestOnly private static $has_one = [ 'HasOneEagerLoadObject' => HasOneEagerLoadObject::class, 'HasOnePolymorphObject' => DataObject::class, + 'MixedBackwardsHasOneEagerLoadObject' => MixedBackwardsHasOneEagerLoadObject::class, ]; private static $belongs_to = [ diff --git a/tests/php/ORM/DataListTest/EagerLoading/MixedBackwardsHasManyEagerLoadObject.php b/tests/php/ORM/DataListTest/EagerLoading/MixedBackwardsHasManyEagerLoadObject.php new file mode 100644 index 00000000000..e134ec060fe --- /dev/null +++ b/tests/php/ORM/DataListTest/EagerLoading/MixedBackwardsHasManyEagerLoadObject.php @@ -0,0 +1,25 @@ + 'Varchar' + ]; + + private static $has_one = [ + 'MixedBackwardsHasOneEagerLoadObject' => MixedBackwardsHasOneEagerLoadObject::class + ]; + + + private static $many_many = [ + 'MixedBackwardsManyManyEagerLoadObjects' => MixedBackwardsManyManyEagerLoadObject::class + ]; +} diff --git a/tests/php/ORM/DataListTest/EagerLoading/MixedBackwardsHasOneEagerLoadObject.php b/tests/php/ORM/DataListTest/EagerLoading/MixedBackwardsHasOneEagerLoadObject.php new file mode 100644 index 00000000000..fb3bb485585 --- /dev/null +++ b/tests/php/ORM/DataListTest/EagerLoading/MixedBackwardsHasOneEagerLoadObject.php @@ -0,0 +1,19 @@ + 'Varchar' + ]; + + private static $has_many = [ + 'MixedBackwardsHasManyEagerLoadObjects' => MixedBackwardsHasManyEagerLoadObject::class + ]; +} diff --git a/tests/php/ORM/DataListTest/EagerLoading/MixedBackwardsManyManyEagerLoadObject.php b/tests/php/ORM/DataListTest/EagerLoading/MixedBackwardsManyManyEagerLoadObject.php new file mode 100644 index 00000000000..e8ba574798b --- /dev/null +++ b/tests/php/ORM/DataListTest/EagerLoading/MixedBackwardsManyManyEagerLoadObject.php @@ -0,0 +1,16 @@ + 'Varchar' + ]; +}