Custom Reports - Custom Data Source Adapters ->don't get it working

#1

Hello,

I’m trying to get custom reports with a custom source adapter working, the final goal is to query data from another db. As my final result is close to what the Sql adapter does, I used it as a starting point.

Prerequisites: XyzBundle

What I did:

  • Copied sql.js from /web/bundles/pimcoreadmin/js/pimcore/report/custom/definitions
    to /web/bundles/xyz/js/report/custom/definitions

  • Renamed it to zyxcmr.js

  • Edited the following lines:
    image
    image

Edited my XyzBundle.php in /src/XyzBundle

Which get me so far:
image

Added to my services.yml in XyzBundle\Recources\config

  • Copied Sql.php from vendor\pimcore\pimcore\models\Tool\CustomReport\Adapter
    to *\src\XyzBundle\Tools\CustomReports\Adapter

Renamed Sql.php to Zyxcmr.php

Edited it to:
image

I believe I covered all the steps, but when I run a simple report like Select * From object_12, I get:

Could not find Custom Report Adapter with type zyxcmr

Any hint or help is super highly appreciated.

0 Likes

#2

Hi,
maybe a case issue? in config your class starts with a capital Z, the class name with a lower z.

BR
Christian

0 Likes

#3

Thanks for the hint, changed Zyxcmr.php to:

Nothing changed, started to debug here:
C:…vendor\pimcore\pimcore\models\Tool\CustomReport\Config.php

Which gives my the following error message:

C:…vendor\pimcore\pimcore\models\Tool\CustomReport\Config.php:182:
object(Symfony\Component\DependencyInjection\ServiceLocator)[895]
private ‘factories’ =>
array (size=2)
‘analytics’ =>
object(Closure)[896]
public ‘this’ =>
object(ContainerUdebcxa\appProdProjectContainer)[106]

‘sql’ =>
object(Closure)[897]
public ‘this’ =>
object(ContainerUdebcxa\appProdProjectContainer)[106]

private ‘loading’ =>
array (size=0)
empty
private ‘externalId’ => null
private ‘container’ => null
{“success”:false,“message”:“Could not find Custom Report Adapter with type zyxcmr”}

I cleared the cache and so on…

0 Likes

#4

Hi,
did you do the last step of the docs here - adding adapter factory to configuration?

BR
Christian

0 Likes

#5

Adding in config.yml

custom_report:
    adapters:
        zyxcmr: pimcore.custom_report.adapter.factory.zyxcmr

and changing the header of Zyxcmr.php

namespace XyzBundle\Tools\CustomReports\Adapter;

use Pimcore\Model\Tool\CustomReport\Adapter\AbstractAdapter;

use Pimcore\Db;

class Zyxcmr extends AbstractAdapter

did the trick!

Many thanks for all the support.

Pimcore is so amazing!

0 Likes