Skip to content

Commit

Permalink
Data-hub tries to access getName method on a fieldCollection class #147
Browse files Browse the repository at this point in the history
  • Loading branch information
weisswurstkanone committed Dec 6, 2019
1 parent 9330f63 commit 12ccd6d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/GraphQL/DataObjectType/ObjectMetadataType.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Pimcore\Bundle\DataHubBundle\GraphQL\Service;
use Pimcore\Bundle\DataHubBundle\GraphQL\Traits\ServiceTrait;
use Pimcore\Model\DataObject\ClassDefinition\Data;
use Pimcore\Model\DataObject\Fieldcollection\Definition;

class ObjectMetadataType extends ObjectType
{
Expand All @@ -45,7 +46,13 @@ public function __construct(Service $graphQlService, Data $fieldDefinition = nul
$this->setGraphQLService($graphQlService);
$this->class = $class;
$this->fieldDefinition = $fieldDefinition;
$config['name'] = 'object_' . $class->getName() . '_' . $fieldDefinition->getName();
if ($class instanceof Definition) {
$config['name'] = 'fieldcollection_' . $class->getKey() . '_' . $fieldDefinition->getName();
} else if ($class instanceof \Pimcore\Model\DataObject\Objectbrick\Definition) {
$config['name'] = 'objectbrick_' . $class->getKey() . '_' . $fieldDefinition->getName();
} else {
$config['name'] = 'object_' . $class->getName() . '_' . $fieldDefinition->getName();
}
$this->build($config);
parent::__construct($config);
}
Expand Down

0 comments on commit 12ccd6d

Please sign in to comment.