Skip to content

Commit

Permalink
BUGFIX: Replace graceful failure of field access on dataobjects (#399)
Browse files Browse the repository at this point in the history
* BUGFIX: Replace graceful failure of field access on dataobjects

* Revise per steve feedback
  • Loading branch information
Aaron Carlino authored Aug 11, 2021
1 parent 877eb23 commit 90570dc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Scaffolding/Scaffolders/DataObjectScaffolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,10 @@ protected function createFields(Manager $manager)
}

$resolver = function ($obj, $args, $context, $info) {
/**
* @var DataObject $obj
*/
$accessor = StaticSchema::inst()->getFieldAccessor();
if (!$accessor || !$accessor->getObjectFieldName($obj, $info->fieldName)) {
return null;
}
$field = StaticSchema::inst()->accessField($obj, $info->fieldName);
// return the raw field value, or checks like `is_numeric()` fail
if ($field instanceof DBField && $field->isInternalGraphQLType()) {
Expand Down

0 comments on commit 90570dc

Please sign in to comment.