[Feature]: extend existing DataObject
BojanHribernik opened this issue · 2 comments
Feature description
Hello
I am trying to extend existing DataObject with additional "virtual" fields not in the database. Is this possible?
I have been struggling with this for two days now ... First I tried to create a Custom Operator, but it gets really complex -> I need to add config generator and field factory and javascript file ... and it still does not work as expected.
<?php
namespace App\GraphQL\DataObjectQueryFieldConfigGenerator;
use Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectQueryOperatorConfigGenerator\Base;
class ElementParent extends Base
{
public function getGraphQlType($typeName, $nodeDef, $class = null, $container = null, $params = []): Type
{
return Type::int(); // how can I return for example `ProductCategory` type here?
}
}
I cannot get the correct type, or I get the correct type, but the wrong resolver executes, and so on ... so I figured that Custom Operator is not the way to go. Am I wrong?
So what is the best way to add a custom field to existing GraphQL DataObject definition?
Thanks
@BojanHribernik Since this is rather a question that an issue, could you please close it here and open a discussion in https://github.com/orgs/pimcore/discussions/categories/data-hub? Thanks!