diff --git a/src/Scaffolding/Scaffolders/CRUD/Create.php b/src/Scaffolding/Scaffolders/CRUD/Create.php index 9a7923428..c2fc6fbab 100644 --- a/src/Scaffolding/Scaffolders/CRUD/Create.php +++ b/src/Scaffolding/Scaffolders/CRUD/Create.php @@ -41,7 +41,7 @@ public function getName() return $name; } - return 'create' . ucfirst($this->getResolvedTypeName()); + return 'create' . ucfirst($this->getTypeName()); } /** @@ -107,7 +107,7 @@ protected function generateInputType(Manager $manager) */ protected function inputTypeName() { - return $this->getResolvedTypeName() . 'CreateInputType'; + return $this->getTypeName() . 'CreateInputType'; } public function resolve($object, array $args, $context, ResolveInfo $info) diff --git a/src/Scaffolding/Scaffolders/CRUD/Delete.php b/src/Scaffolding/Scaffolders/CRUD/Delete.php index d99193b9e..be10dcec4 100644 --- a/src/Scaffolding/Scaffolders/CRUD/Delete.php +++ b/src/Scaffolding/Scaffolders/CRUD/Delete.php @@ -39,7 +39,7 @@ public function getName() return $name; } - return 'delete' . ucfirst($this->getResolvedTypeName()); + return 'delete' . ucfirst($this->getTypeName()); } /** diff --git a/src/Scaffolding/Scaffolders/CRUD/Read.php b/src/Scaffolding/Scaffolders/CRUD/Read.php index a171fa246..a4e3f846c 100644 --- a/src/Scaffolding/Scaffolders/CRUD/Read.php +++ b/src/Scaffolding/Scaffolders/CRUD/Read.php @@ -45,7 +45,7 @@ public function getName() return $name; } - $typePlural = $this->pluralise($this->getResolvedTypeName()); + $typePlural = $this->pluralise($this->getTypeName()); return 'read' . ucfirst($typePlural); } diff --git a/src/Scaffolding/Scaffolders/CRUD/ReadOne.php b/src/Scaffolding/Scaffolders/CRUD/ReadOne.php index 2ac687cb6..d23ecab0a 100644 --- a/src/Scaffolding/Scaffolders/CRUD/ReadOne.php +++ b/src/Scaffolding/Scaffolders/CRUD/ReadOne.php @@ -34,7 +34,7 @@ public function getName() return $name; } - return 'readOne' . ucfirst($this->getResolvedTypeName()); + return 'readOne' . ucfirst($this->getTypeName()); } /** diff --git a/src/Scaffolding/Scaffolders/CRUD/Update.php b/src/Scaffolding/Scaffolders/CRUD/Update.php index 8c466576f..74b62e68f 100644 --- a/src/Scaffolding/Scaffolders/CRUD/Update.php +++ b/src/Scaffolding/Scaffolders/CRUD/Update.php @@ -42,7 +42,7 @@ public function getName() return $name; } - return 'update' . ucfirst($this->getResolvedTypeName()); + return 'update' . ucfirst($this->getTypeName()); } /** @@ -114,7 +114,7 @@ protected function generateInputType(Manager $manager) */ protected function inputTypeName() { - return $this->getResolvedTypeName() . 'UpdateInputType'; + return $this->getTypeName() . 'UpdateInputType'; } /** diff --git a/src/Scaffolding/Scaffolders/DataObjectScaffolder.php b/src/Scaffolding/Scaffolders/DataObjectScaffolder.php index 51999556e..374c82724 100644 --- a/src/Scaffolding/Scaffolders/DataObjectScaffolder.php +++ b/src/Scaffolding/Scaffolders/DataObjectScaffolder.php @@ -82,7 +82,7 @@ public function __construct($dataObjectClass) */ public function getTypeName() { - return $this->getDataObjectTypeName(); + return $this->typeName(); } /** diff --git a/src/Scaffolding/Scaffolders/ListQueryScaffolder.php b/src/Scaffolding/Scaffolders/ListQueryScaffolder.php index 33f2ecb4b..923d0667c 100644 --- a/src/Scaffolding/Scaffolders/ListQueryScaffolder.php +++ b/src/Scaffolding/Scaffolders/ListQueryScaffolder.php @@ -130,7 +130,7 @@ public function applyConfig(array $config) } else { throw new InvalidArgumentException(sprintf( 'sortableFields must be an array (see %s)', - $this->getResolvedTypeName() + $this->getTypeName() )); } } diff --git a/src/Scaffolding/Scaffolders/MutationScaffolder.php b/src/Scaffolding/Scaffolders/MutationScaffolder.php index 4cc638881..09b602492 100644 --- a/src/Scaffolding/Scaffolders/MutationScaffolder.php +++ b/src/Scaffolding/Scaffolders/MutationScaffolder.php @@ -61,15 +61,9 @@ public function scaffold(Manager $manager) ]; } - /** - * If a type name has not been assigned, fallback to the typename that gets generated - * off the dataobject - * - * @return string - */ - protected function getResolvedTypeName() + public function getTypeName() { - return $this->getTypeName() ?: $this->getDataObjectTypeName(); + return parent::getTypeName() ?: $this->typeName(); } /** diff --git a/src/Scaffolding/Scaffolders/QueryScaffolder.php b/src/Scaffolding/Scaffolders/QueryScaffolder.php index fa24e8098..fc0af47c4 100644 --- a/src/Scaffolding/Scaffolders/QueryScaffolder.php +++ b/src/Scaffolding/Scaffolders/QueryScaffolder.php @@ -71,15 +71,9 @@ public function setNested($bool) return $this; } - /** - * If a type name has not been assigned, fallback to the typename that gets generated - * off the dataobject - * - * @return string - */ - protected function getResolvedTypeName() + public function getTypeName() { - return $this->getTypeName() ?: $this->getDataObjectTypeName(); + return parent::getTypeName() ?: $this->typeName(); } /** diff --git a/src/Scaffolding/Traits/DataObjectTypeTrait.php b/src/Scaffolding/Traits/DataObjectTypeTrait.php index c62a4d6c2..8f6e66d1b 100644 --- a/src/Scaffolding/Traits/DataObjectTypeTrait.php +++ b/src/Scaffolding/Traits/DataObjectTypeTrait.php @@ -33,10 +33,11 @@ public function getDataObjectClass() /** * Type name inferred from the dataobject. + * This should not be called directly, but only by getTypeName() * * @return string */ - public function getDataObjectTypeName() + protected function typeName() { $dataObjectClass = $this->getDataObjectClass(); if (!$dataObjectClass) {