KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Dashboard Application ErrorException: Undefined index getKDR() returns null #3208

Open Igor Matjasic opened this topic on on Dec 8, 2023 - 6 comments

Igor Matjasic commented on Dec 8, 2023

I am trying to set up the quick start in my existing PHP Yii applicaiton. https://www.koolreport.com/docs/dashboard/quick_start/

I get the following error ErrorException: Undefined index: in /opt/bitnami/apache2/htdocs/protected/extensions/koolreport/dashboard/Application.php:360

Looking at the APplication.php code and where the error occurs, I can see that the error occurs because the following code at line 353 returns null $next = $this->request()->nextHandler($this);

Through further debugging I can see taht the getKDR() function inside the Request class returns null. Why does this occur?

Below is my code for the application

<?php

use \koolreport\dashboard\Application;

class CoriApp extends Application
{
    protected function sidebar()
    {
        return [
            "Nonconformity Board"=>CoriBoard::create()
        ];
    }
}

Below is my code for the view file.

<?php
//require_once  "vendor/autoload.php"; //Load library
require_once __DIR__ . "/../../models/dashboards/CoriApp.php";

CoriApp::create()->run();
?>

The library is loaded in my module file of my MVC structure The view file above is loaded through my controller in the code below

    public function actionCoriDashboard(){
        $this->render('coriDashboard', array());
    }

Any help would be appreciated!

KoolReport commented on Dec 13, 2023

Let not using the view file to host the dashboard app, let put it directly inside your action like this:

    require_once __DIR__ . "/../../models/dashboards/CoriApp.php"; //Put on top of your controller class
    ...
    public function actionCoriDashboard(){
        CoriApp::create()->run();
    }

Let me know if there is any difference.

Igor Matjasic commented on Dec 14, 2023

Nothing, I get the same error.

Nick Perkins commented on Mar 26

Is there not instructions for setting this up in Yii2?

Sebastian Morales commented on Apr 3

If you intend to use KoolReport Dashboard in Yii2, pls config your App class with Yii2 trait like in the following docs:

https://www.koolreport.com/docs/dashboard/application/#assets-auto-configure-assets-with-other-mvc-frameworks

If there's any issue pls let us know. Tks,

Nick Perkins commented on Apr 3

Yeah I have done that. Still doesn't work. You need more instructions for Yii framework. This is not working at all for dashboard.

KoolReport commented on Apr 4

This original error is solved by changing all the "CoriApp" name to "App" only.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

None