From 13725d2f9228d8793e03eb2eb5d837d4b4becf6f Mon Sep 17 00:00:00 2001 From: cloph Date: Sat, 12 Sep 2020 02:56:23 +0200 Subject: [PATCH] DOC HistoryViewer: explain "magic names" (#9670) DOC HistoryViewer: explain "magic names" GraphQL scaffolding uses names consisting of the first part of the namespace and the classname, but to inject it to the HistoryViewer field you need to use the database table name. Co-authored-by: Steve Boyd --- .../00_Model/10_Versioning.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/en/02_Developer_Guides/00_Model/10_Versioning.md b/docs/en/02_Developer_Guides/00_Model/10_Versioning.md index 6350d7cc9..571e349f7 100644 --- a/docs/en/02_Developer_Guides/00_Model/10_Versioning.md +++ b/docs/en/02_Developer_Guides/00_Model/10_Versioning.md @@ -1243,6 +1243,22 @@ window.document.addEventListener('DOMContentLoaded', () => { ); }); ``` +[hint] +GraphQL scaffolding derives the names for the schema from the first part of the namespace and the classname, while in +the Injector the database table name is used. So in the case of +```php +namespace Foo\Bar; +// … +class MyVersionedObject extends DataObject +{ + private static $table_name = 'MyTableName'; + // … +} +``` +you would have to use `readOneFooMyVersionedObject`, `rollbackFooMyVersionedObject` and +`HistoryViewerToolbar.VersionedAdmin.HistoryViewer.MyTableName.HistoryViewerVersionDetail` respectively +[/hint] + For more information, see [ReactJS, Redux and GraphQL](../../customising_the_admin_interface/react_redux_and_graphql).