Improvement description
Currently, \Pimcore\Bundle\DataHubBundle\GraphQL\ClassTypeDefinitions::build is creating type instances for all classes on every request
|
public static function build(Service $graphQlService, $context = []) |
|
{ |
|
$db = Db::get(); |
|
$listing = $db->fetchAllAssociative('SELECT id, name FROM classes'); |
|
|
|
foreach ($listing as $class) { |
|
$id = $class['id']; |
|
$name = $class['name']; |
|
$objectType = new PimcoreObjectType($graphQlService, $name, $id, [], $context); |
|
self::$definitions[$name] = $objectType; |
|
} |
|
|
|
/** |
|
* @var string $name |
|
* @var PimcoreObjectType $definition |
|
*/ |
|
foreach (self::$definitions as $name => $definition) { |
|
$definition->build($context); |
|
} |
|
} |
but not all classes will be used. It would make sense to convert this to a lazy loaded version where the instance is only created when get() is called.
This build process is almost 40% of the runtime in trivial GraphQL queries.

Improvement description
Currently,
\Pimcore\Bundle\DataHubBundle\GraphQL\ClassTypeDefinitions::buildis creating type instances for all classes on every requestdata-hub/src/GraphQL/ClassTypeDefinitions.php
Lines 35 to 54 in f781127
but not all classes will be used. It would make sense to convert this to a lazy loaded version where the instance is only created when
get()is called.This build process is almost 40% of the runtime in trivial GraphQL queries.