oroinc / platform

Main OroPlatform package with core functionality.
MIT License
629 stars 351 forks source link

Datagrid export for other datagrid sources then ORM. #1076

Open hvanoch opened 2 years ago

hvanoch commented 2 years ago

Summary
When trying to export a datagrid with a non "ORM" datasource an exception is thrown in the export processor.

Steps to reproduce
Create a datagrid with array datasource and set export: true in grid config

Actual Result

In DatagridExportIdFetcher.php line 90:

  [Symfony\Component\Debug\Exception\UndefinedMethodException]                                                                                       
  Attempted to call an undefined method named "getQueryBuilder" of class "\Oro\Bundle\DataGridBundle\Datasource\ArrayDatasource\ArrayDatasource".  

Exception trace:
  at /var/www/html/vendor/oro/platform/src/Oro/Bundle/DataGridBundle/ImportExport/DatagridExportIdFetcher.php:90
 Oro\Bundle\DataGridBundle\ImportExport\DatagridExportIdFetcher->getGridRootEntity() at /var/www/html/vendor/oro/platform/src/Oro/Bundle/DataGridBundle/Handler/ExportHandler.php:164
 Oro\Bundle\DataGridBundle\Handler\ExportHandler->getEntityName() at /var/www/html/vendor/oro/platform/src/Oro/Bundle/DataGridBundle/Async/Export/PreExportMessageProcessor.php:130
 Oro\Bundle\DataGridBundle\Async\Export\PreExportMessageProcessor->getMessageBody() at /var/www/html/vendor/oro/platform/src/Oro/Bundle/ImportExportBundle/Async/Export/PreExportMessageProcessorAbstract.php:92
 Oro\Bundle\ImportExportBundle\Async\Export\PreExportMessageProcessorAbstract->process() at /var/www/html/vendor/oro/platform/src/Oro/Component/MessageQueue/Client/DelegateMessageProcessor.php:36
 Oro\Component\MessageQueue\Client\DelegateMessageProcessor->process() at /var/www/html/vendor/oro/platform/src/Oro/Component/MessageQueue/Consumption/QueueConsumer.php:192
 Oro\Component\MessageQueue\Consumption\QueueConsumer->doConsume() at /var/www/html/vendor/oro/platform/src/Oro/Component/MessageQueue/Consumption/QueueConsumer.php:127
 Oro\Component\MessageQueue\Consumption\QueueConsumer->consume() at /var/www/html/vendor/oro/platform/src/Oro/Component/MessageQueue/Client/ConsumeMessagesCommand.php:96
 Oro\Component\MessageQueue\Client\ConsumeMessagesCommand->consume() at /var/www/html/vendor/oro/platform/src/Oro/Bundle/MessageQueueBundle/Command/ClientConsumeMessagesCommand.php:46
 Oro\Bundle\MessageQueueBundle\Command\ClientConsumeMessagesCommand->consume() at /var/www/html/vendor/oro/platform/src/Oro/Component/MessageQueue/Client/ConsumeMessagesCommand.php:90
 Oro\Component\MessageQueue\Client\ConsumeMessagesCommand->execute() at /var/www/html/vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:1027
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:97
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:273
 Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/symfony/framework-bundle/Console/Application.php:83
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /var/www/html/vendor/symfony/console/Application.php:149
 Symfony\Component\Console\Application->run() at /var/www/html/bin/console:29

Expected Result
Export to also work with non orm datasource types

Details about your environment

anyt commented 2 years ago

The array data source has a very limited list of features. Export is one of the features that is not implemented for it.