Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3'
Browse files Browse the repository at this point in the history
  • Loading branch information
chillu committed Jan 30, 2019
2 parents a15752e + 2e4b121 commit bc5804d
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/Scaffolding/Scaffolders/CRUD/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function getName()
return $name;
}

return 'create' . ucfirst($this->getTypeName());
return 'create' . ucfirst($this->getResolvedTypeName());
}

/**
Expand Down Expand Up @@ -107,7 +107,7 @@ protected function generateInputType(Manager $manager)
*/
protected function inputTypeName()
{
return $this->getTypeName() . 'CreateInputType';
return $this->getResolvedTypeName() . 'CreateInputType';
}

public function resolve($object, array $args, $context, ResolveInfo $info)
Expand Down
2 changes: 1 addition & 1 deletion src/Scaffolding/Scaffolders/CRUD/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getName()
return $name;
}

return 'delete' . ucfirst($this->getTypeName());
return 'delete' . ucfirst($this->getResolvedTypeName());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Scaffolding/Scaffolders/CRUD/Read.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getName()
return $name;
}

$typePlural = $this->pluralise($this->getTypeName());
$typePlural = $this->pluralise($this->getResolvedTypeName());
return 'read' . ucfirst($typePlural);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Scaffolding/Scaffolders/CRUD/ReadOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function getName()
return $name;
}

return 'readOne' . ucfirst($this->getTypeName());
return 'readOne' . ucfirst($this->getResolvedTypeName());
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Scaffolding/Scaffolders/CRUD/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function getName()
return $name;
}

return 'update' . ucfirst($this->getTypeName());
return 'update' . ucfirst($this->getResolvedTypeName());
}

/**
Expand Down Expand Up @@ -114,7 +114,7 @@ protected function generateInputType(Manager $manager)
*/
protected function inputTypeName()
{
return $this->getTypeName() . 'UpdateInputType';
return $this->getResolvedTypeName() . 'UpdateInputType';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Scaffolding/Scaffolders/DataObjectScaffolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function __construct($dataObjectClass)
*/
public function getTypeName()
{
return $this->typeName();
return $this->getDataObjectTypeName();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Scaffolding/Scaffolders/ListQueryScaffolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function applyConfig(array $config)
} else {
throw new InvalidArgumentException(sprintf(
'sortableFields must be an array (see %s)',
$this->getTypeName()
$this->getResolvedTypeName()
));
}
}
Expand Down
10 changes: 8 additions & 2 deletions src/Scaffolding/Scaffolders/MutationScaffolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,15 @@ public function scaffold(Manager $manager)
];
}

public function getTypeName()
/**
* If a type name has not been assigned, fallback to the typename that gets generated
* off the dataobject
*
* @return string
*/
protected function getResolvedTypeName()
{
return parent::getTypeName() ?: $this->typeName();
return $this->getTypeName() ?: $this->getDataObjectTypeName();
}

/**
Expand Down
10 changes: 8 additions & 2 deletions src/Scaffolding/Scaffolders/QueryScaffolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,15 @@ public function setNested($bool)
return $this;
}

public function getTypeName()
/**
* If a type name has not been assigned, fallback to the typename that gets generated
* off the dataobject
*
* @return string
*/
protected function getResolvedTypeName()
{
return parent::getTypeName() ?: $this->typeName();
return $this->getTypeName() ?: $this->getDataObjectTypeName();
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Scaffolding/Traits/DataObjectTypeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ public function getDataObjectClass()

/**
* Type name inferred from the dataobject.
* This should not be called directly, but only by getTypeName()
*
* @return string
*/
protected function typeName()
public function getDataObjectTypeName()
{
$dataObjectClass = $this->getDataObjectClass();
if (!$dataObjectClass) {
Expand Down

0 comments on commit bc5804d

Please sign in to comment.