forked from silverstripe/silverstripe-graphql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Temporary workaround with withDescendants
- Loading branch information
Showing
2 changed files
with
43 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,16 @@ class DataObjectScaffolder implements ManagerMutatorInterface, ScaffolderInterfa | |
*/ | ||
protected $nestedQueries = []; | ||
|
||
/** | ||
* @var bool Include ancestors and descendants in the types. | ||
* Works around a regression which existing CMS GraphQL queries rely on. | ||
* See https://github.com/silverstripe/silverstripe-versioned-admin/issues/98 | ||
* The proper default should be withDescendants=true. | ||
* There's also a proposal for restructuring that whole thing: | ||
* https://github.com/silverstripe/silverstripe-graphql/issues/209 | ||
*/ | ||
protected $withDescendants = false; | ||
|
||
/** | ||
* DataObjectScaffold constructor. | ||
* | ||
|
@@ -75,10 +85,26 @@ public function __construct($dataObjectClass) | |
$this->setDataObjectClass($dataObjectClass); | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function getWithDescendants() | ||
{ | ||
return $this->withDescendants; | ||
} | ||
|
||
/** | ||
* @param bool $withDescendants | ||
*/ | ||
public function setWithDescendants($withDescendants) | ||
{ | ||
$this->withDescendants = $withDescendants; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
} | ||
|
||
/** | ||
* Name of graphql type | ||
* | ||
* @return string | ||
* @return strinnestedQueryg | ||
This comment has been minimized.
Sorry, something went wrong. |
||
*/ | ||
public function getTypeName() | ||
{ | ||
|
@@ -538,6 +564,10 @@ public function applyConfig(array $config) | |
} | ||
} | ||
|
||
if (isset($config['withDescendants'])) { | ||
$this->setWithDescendants((bool)$config['withDescendants']); | ||
This comment has been minimized.
Sorry, something went wrong.
unclecheese
|
||
} | ||
|
||
return $this; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fluent APIs, please