Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined property: stdClass::$filter at /var/www/vendor/coroowicaksono/chart-js-integration/src/api/TotalRecordsController.php #173

Open
alishanda opened this issue Dec 16, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@alishanda
Copy link

Hi
I use this library with
Laravel 10.25.2
Nova 4.27.13
Laravel and Nova with totally default settings. I just install them.

Every time I try to create any chart from model I have this error in my logs

[2023-12-14 12:17:59] local.ERROR: Undefined property: stdClass::$filter {"exception":"[object] (ErrorException(code: 0): Undefined property: stdClass::$filter at /var/www/vendor/coroowicaksono/chart-js-integration/src/api/TotalRecordsController.php:60)

It's this part of TotalRecordsController

if(isset($request->series)){
                foreach($request->series as $seriesKey => $serieslist){
                    $seriesData = (object) $serieslist;
                    $filter = (object) $seriesData->filter;

After some investigation I find out that Laravel Controller unserialize json object series as

[2023-12-14 12:19:51] local.ERROR: Array
(
    [0] => {"label":"Product A","filter":{"key":"type","value":"post_income"},"fill":false}
    [1] => {"label":"Product A","filter":{"key":"type","value":"post_income"},"fill":false}
    [2] => {"label":"Product A","filter":{"key":"type","value":"post_income"},"fill":false}
)

So final object looks like this

[2023-12-14 12:06:35] local.ERROR: stdClass Object
(
    [scalar] => {"label":"Product A","filter":{"key":"type","value":"post_income"},"fill":false}
)

When I fix this like this - everything starts to work
$seriesData = (object) json_decode($serieslist, true);

But, obviously it's not a decision. Can you please tell me what I'm doing wrong and how to fix this.

@alishanda alishanda added the bug Something isn't working label Dec 16, 2023
@hemant17
Copy link

I am facing the same issues
Undefined property: stdClass::$filter {"userId":2,"exception":"[object] (ErrorException(code: 0): Undefined property: stdClass::$filter at /var/www/nextlevelbot.com/vendor/coroowicaksono/chart-js-integration/src/api/TotalRecordsController.php:59)
after update to ^0.4.0

@Sinecuraweb
Copy link

I have fixed this problem, but PR has not been accepted yet

#176

@hemant17
Copy link

hemant17 commented Feb 1, 2024

@coroo Please Take a look need that urgently because of breaking changes in Client project of Nova

@stiplady
Copy link

stiplady commented Feb 7, 2024

Thanks for proposing a fix for this @Sinecuraweb - I also had this issue while testing replacements for the standard charts. Hoping it is approved by @coroo soon.

@stiplady
Copy link

@hemant17 @Sinecuraweb @alishanda I found the root cause of the issue. This module was updated to be compatible with Nova 4.31, update your copies of Nova and this issue will be resolved.

@coroo Please update composer.json to require versions of Nova at least 4.31

@hemant17
Copy link

But i don't want to update because @stiplady it's a large project and have other complexx thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants