From 3c83a619888a95edc93a0f6a095f028fd87cb1c3 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 25 Feb 2021 23:51:25 +1300 Subject: [PATCH] FIX GraphQL4 config, add table names to pages --- _config/graphql.yml | 67 +++++++++++----------- code/multitab-validation/MultiTabPage.php | 2 + code/multitab-validation/SingleTabPage.php | 2 + 3 files changed, 38 insertions(+), 33 deletions(-) diff --git a/_config/graphql.yml b/_config/graphql.yml index 9e42f03..3cae983 100644 --- a/_config/graphql.yml +++ b/_config/graphql.yml @@ -23,36 +23,37 @@ SilverStripe\Control\Director: SilverStripe\GraphQL\Schema\Schema: schemas: frameworktest: - modelConfig: - type_mapping: - SilverStripe\FrameworkTest\Model\Company: Company - SilverStripe\FrameworkTest\Model\Employee: Employee - models: - SilverStripe\FrameworkTest\Model\Company: - fields: - ID: true - Name: true - Category: true - Revenue: true - CEO: true - Employees: true - PastEmployees: true - operations: - read: true - update: true - create: true - delete: true - readOne: true - SilverStripe\FrameworkTest\Model\Employee: - fields: - ID: true - Name: true - Biography: true - DateOfBirth: true - Category: true - operations: - read: true - update: true - create: true - delete: true - readOne: true + config: + modelConfig: + type_mapping: + SilverStripe\FrameworkTest\Model\Company: Company + SilverStripe\FrameworkTest\Model\Employee: Employee + models: + SilverStripe\FrameworkTest\Model\Company: + fields: + ID: true + Name: true + Category: true + Revenue: true + CEO: true + Employees: true + PastEmployees: true + operations: + read: true + update: true + create: true + delete: true + readOne: true + SilverStripe\FrameworkTest\Model\Employee: + fields: + ID: true + Name: true + Biography: true + DateOfBirth: true + Category: true + operations: + read: true + update: true + create: true + delete: true + readOne: true diff --git a/code/multitab-validation/MultiTabPage.php b/code/multitab-validation/MultiTabPage.php index 09f493f..a0f7b72 100644 --- a/code/multitab-validation/MultiTabPage.php +++ b/code/multitab-validation/MultiTabPage.php @@ -15,6 +15,8 @@ if (!class_exists(Page::class)) { */ class MultiTabPage extends Page { + private static $table_name = 'MultiTabPage'; + private static $db = [ 'SecondTabFirstField' => 'Varchar(50)', 'ThirdTabFirstField' => 'Varchar(50)', diff --git a/code/multitab-validation/SingleTabPage.php b/code/multitab-validation/SingleTabPage.php index c79aa43..4c7d8f7 100644 --- a/code/multitab-validation/SingleTabPage.php +++ b/code/multitab-validation/SingleTabPage.php @@ -14,6 +14,8 @@ if (!class_exists(Page::class)) { */ class SingleTabPage extends Page { + private static $table_name = 'SingleTabPage'; + public function getCMSValidator() { return new RequiredFields([