KoolReport's Forum

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

Fatal error: Uncaught Error: Class not found #1279

Open tafadzwa opened this topic on on Jan 31, 2020 - 7 comments

tafadzwa commented on Jan 31, 2020

This is the error I am getting when I try to have monthly sales from my Sql table displayed on a graph using koolreport ( Fatal error: Uncaught Error: Class 'koolreport\widgets\google\ColumnChart' not found in C:\xampp\htdocs\bata\pages\salesrepo.view.php:111 Stack trace: #0 {main} thrown in C:\xampp\htdocs\bata\pages\salesrepo.view.php on line 111).

The code is displayed below

index.php code

<?php 
require_once "koolreport/autoload.php";
require_once "salesrepo.php";
$report = new salesrepo;
$report->run()->render();
?>

salesrepo.view.php

<?php 
    use \koolreport\widgets\koolphp\Table;
    use \koolreport\widgets\google\ColumnChart;
?>
<?php
    ColumnChart::create(array(
        "dataStore"=>$this->dataStore('sale_by_month'),  
        "columns"=>array(
            "Date_TimeAdded"=>array(
                "label"=>"Month",
                "type"=>"datetime",
                "format"=>"Y-n",
                "displayFormat"=>"F, Y",
            ),
            "Value1"=>array(
                "label"=>"Value1",
                "type"=>"number",
                "prefix"=>"$",
            )
        ),
        "width"=>"100%",
    ));
 ?>

<?php
    Table::create(array(
        "dataStore"=>$this->dataStore('sale_by_month'),
        "columns"=>array(
            "Date_TimeAdded"=>array(
                "label"=>"Month",
                "type"=>"datetime",
                "format"=>"Y-n",
                "displayFormat"=>"F, Y",
            ),
            "Value1"=>array(
                "label"=>"Value1",
                "type"=>"number",
                "prefix"=>"$",
                        )
        ),
        "cssClass"=>array(
            "table"=>"table table-hover table-bordered"
        )
    ));
?>

salesrepo.php

<?php
require_once "/koolreport/autoload.php";
require_once "/koolreport/koolreport.php";

use \koolreport\KoolReport;
use \koolreport\processes\Filter;
use \koolreport\processes\TimeBucket;
use \koolreport\processes\Group;
use \koolreport\processes\Limit;

class salesrepo extends \koolreport\KoolReport
{
    function settings()
    {
        return array(
            "dataSources"=>array(
                "sales_repo"=>array(
                    "connectionString"=>"mysql:host=localhost;dbname=batasales",
                    "username"=>"root",
                    "password"=>"",
                    "charset"=>"utf8"
					"class"=>"koolreport\dataSources\MySQLDataSource"
                ),
            )
        ); 
    }    
    protected function setup()
    {
        $this->src('sales_repo')
        ->query("SELECT Date_TimeAdded,Value1 FROM rm80")
        ->pipe(new TimeBucket(array(
            "Date_TimeAdded"=>"month"
        )))
        ->pipe(new Group(array(
            "by"=>"Date_TimeAdded",
            "sum"=>"Value1"
        )))
        ->pipe($this->dataStore('sale_by_month'));
    } 
}
?>     
KoolReport commented on Jan 31, 2020

If you remove

require_once "/koolreport/autoload.php";
require_once "/koolreport/koolreport.php";

does it work?

tafadzwa commented on Feb 3, 2020

No it does not work

David Winterburn commented on Feb 3, 2020

Hi,

Would you please post a screenshot of your web folder structure? Thanks!

tafadzwa commented on Feb 3, 2020

David Winterburn commented on Feb 4, 2020

Please replace:

require_once "/koolreport/autoload.php";

with:

require_once "/koolreport/core/autoload.php";

Let us know how it works for you. Thanks!

tafadzwa commented on Feb 4, 2020

Thanks for the response, but I am still getting the same error

KoolReport commented on Feb 4, 2020

Please do:

require_once "koolreport/core/autoload.php";

Remove the slash in front of koolreport, please check the path to make sure that you require the correct autoload.php inside koolreport/core.

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
None yet

None