pimcore / generic-data-index-bundle

Other
3 stars 1 forks source link

Creating Data Object Class with not supported data types throws errors #81

Closed fashxp closed 3 months ago

fashxp commented 4 months ago

e.g. import following class definition: https://github.com/pimcore/saas-k6/blob/2024.x/tests/modules/dataObjects/data/class_automaticTestFull_export.json

fashxp commented 4 months ago

seems color is not supported yet?

fashxp commented 4 months ago

[2024-02-27T22:03:48.272385+00:00] app.INFO: Pimcore\Loader\ImplementationLoader\Exception\UnsupportedException: Loader for "color" was not found in /var/www/html/vendor/pimcore/pimcore/lib/Loader/ImplementationLoader/ImplementationLoader.php:90 Stack trace: #0 /var/www/html/vendor/pimcore/pimcore/lib/Model/DataObject/ClassDefinition/Loader/DataLoader.php(30): Pimcore\Loader\ImplementationLoader\ImplementationLoader->build('color', Array) #1 /var/www/html/vendor/pimcore/pimcore/models/DataObject/Classificationstore/Service.php(83): Pimcore\Model\DataObject\ClassDefinition\Loader\DataLoader->build('color') #2 /var/www/html/vendor/pimcore/pimcore/models/DataObject/Classificationstore/Service.php(64): Pimcore\Model\DataObject\Classificationstore\Service::getFieldDefinitionFromJson(Array, 'color') #3 /var/www/html/vendor/pimcore/static-resolver-bundle/src/Models/DataObject/ClassificationStore/ServiceResolver.php(37): Pimcore\Model\DataObject\Classificationstore\Service::getFieldDefinitionFromKeyConfig(Object(Pimcore\Model\DataObject\Classificationstore\KeyGroupRelation)) #4 /var/www/html/vendor/pimcore/generic-data-index-bundle/src/Service/SearchIndex/DataObject/FieldDefinitionAdapter/ClassificationStoreAdapter.php(69): Pimcore\Bundle\StaticResolverBundle\Models\DataObject\ClassificationStore\ServiceResolver->getFieldDefinitionFromKeyConfig(Object(Pimcore\Model\DataObject\Classificationstore\KeyGroupRelation)) #5 /var/www/html/vendor/pimcore/generic-data-index-bundle/src/Service/SearchIndex/DataObject/FieldDefinitionAdapter/ClassificationStoreAdapter.php(53): Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\DataObject\FieldDefinitionAdapter\ClassificationStoreAdapter->getMappingForGroupConfig(Array) #6 /var/www/html/vendor/pimcore/generic-data-index-bundle/src/Service/SearchIndex/IndexService/IndexHandler/DataObjectIndexHandler.php(82): Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\DataObject\FieldDefinitionAdapter\ClassificationStoreAdapter->getOpenSearchMapping() #7 /var/www/html/vendor/pimcore/generic-data-index-bundle/src/Service/SearchIndex/IndexService/IndexHandler/DataObjectIndexHandler.php(41): Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\IndexService\IndexHandler\DataObjectIndexHandler->extractMappingByClassDefinition(Object(Pimcore\Model\DataObject\ClassDefinition)) #8 /var/www/html/vendor/pimcore/generic-data-index-bundle/src/Service/SearchIndex/IndexService/IndexHandler/AbstractIndexHandler.php(83): Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\IndexService\IndexHandler\DataObjectIndexHandler->extractMappingProperties(Object(Pimcore\Model\DataObject\ClassDefinition)) #9 /var/www/html/vendor/pimcore/generic-data-index-bundle/src/Service/SearchIndex/IndexService/IndexHandler/AbstractIndexHandler.php(44): Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\IndexService\IndexHandler\AbstractIndexHandler->doUpdateMapping(Object(Pimcore\Model\DataObject\ClassDefinition)) #10 /var/www/html/vendor/pimcore/generic-data-index-bundle/src/EventSubscriber/DataObjectIndexUpdateSubscriber.php(135): Pimcore\Bundle\GenericDataIndexBundle\Service\SearchIndex\IndexService\IndexHandler\AbstractIndexHandler->updateMapping(Object(Pimcore\Model\DataObject\ClassDefinition), true) #11 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(260): Pimcore\Bundle\GenericDataIndexBundle\EventSubscriber\DataObjectIndexUpdateSubscriber->updateDataObjectMapping(Object(Pimcore\Event\Model\DataObject\ClassDefinitionEvent), 'pimcore.class.p...', Object(Symfony\Component\EventDispatcher\EventDispatcher)) #12 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(220): Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher{closure}(Object(Pimcore\Event\Model\DataObject\ClassDefinitionEvent), 'pimcore.class.p...', Object(Symfony\Component\EventDispatcher\EventDispatcher)) #13 /var/www/html/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'pimcore.class.p...', Object(Pimcore\Event\Model\DataObject\ClassDefinitionEvent)) #14 /var/www/html/vendor/pimcore/pimcore/lib/Event/Traits/RecursionBlockingEventDispatchHelperTrait.php(36): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(Pimcore\Event\Model\DataObject\ClassDefinitionEvent), 'pimcore.class.p...') #15 /var/www/html/vendor/pimcore/pimcore/models/DataObject/ClassDefinition.php(402): Pimcore\Model\DataObject\ClassDefinition->dispatchEvent(Object(Pimcore\Event\Model\DataObject\ClassDefinitionEvent), 'pimcore.class.p...') #16 /var/www/html/vendor/pimcore/admin-ui-classic-bundle/src/Controller/Admin/DataObject/ClassController.php(483): Pimcore\Model\DataObject\ClassDefinition->save() #17 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(181): Pimcore\Bundle\AdminBundle\Controller\Admin\DataObject\ClassController->saveAction(Object(Symfony\Component\HttpFoundation\Request)) #18 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #19 /var/www/html/vendor/symfony/http-kernel/Kernel.php(197): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /var/www/html/vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php(35): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #21 /var/www/html/vendor/autoload_runtime.php(29): Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run() #22 /var/www/html/public/index.php(19): require_once('/var/www/html/v...') #23 {main} [] []

markus-moser commented 4 months ago

@martineiber Could you please check this?

martineiber commented 4 months ago

@fashxp I have checked this out. This is coming from the ClassificationStoreAdapter.

I think there is an error in the k6 tests when setting up the Classification Store. There is no color type. There is only rgbaColor in Pimcore, right? https://github.com/pimcore/saas-k6/blob/16916aa776b1dda16d2d507e78e2c9abfb9ae1aa/tests/modules/dataObjects/data/data.js#L45

That's why the Field Definition could not be found.

In addition i created a PR which logs a warning if the Field Definition can not be found. https://github.com/pimcore/generic-data-index-bundle/pull/89

fashxp commented 3 months ago

@martineiber good catch, thx very much. had some other problem with the k6 tests, but now they run through :)