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

[Bug]: Calling static trait method LaraZeus\Bolt\Concerns\Designer::ui is deprecated #331

Open
eelco2k opened this issue Oct 24, 2024 · 17 comments
Labels
bug Something isn't working

Comments

@eelco2k
Copy link

eelco2k commented Oct 24, 2024

What happened?

Calling static trait method LaraZeus\Bolt\Concerns\Designer::ui is deprecated, it should only be called on a class using the traitvendor/lara-zeus/bolt/src/Livewire/FillForms.php#51ErrorException

    {
        $getDesignerClass = $this->getBoltFormDesigner() ?? Designer::class;

        return $getDesignerClass::ui($this->zeusForm, $this->inline);
    }

    protected function getFormModel(): Form

it only happens when i enable barryvdh/laravel-debugbar.

How to reproduce the bug

open a form on the frontend side with barryvdh/laravel-debugbar enabled

Package Version

v3.0.68

PHP Version

8.3.12

Laravel Version

10.48.22

Which operating systems does with happen with?

macOS

Notes

No response

@eelco2k eelco2k added the bug Something isn't working label Oct 24, 2024
@atmonshi
Copy link
Member

do you have getBoltFormDesigner?

@eelco2k
Copy link
Author

eelco2k commented Oct 24, 2024

is it only in the paid version? then no. i use free version.

@atmonshi
Copy link
Member

no, its available for the free.
if not, then I am afraid its not reproducible for me! its working in the demo app. using php 8.3.12

@atmonshi
Copy link
Member

are overriding the form resources or any part of it?
in the class FillForms confirm if the trait use Designer; exist

@eelco2k
Copy link
Author

eelco2k commented Oct 24, 2024

have you also done: php artisan optimize
?

@eelco2k
Copy link
Author

eelco2k commented Oct 24, 2024

as this caches config and routes

@atmonshi
Copy link
Member

artisan storage:link
artisan migrate --force
artisan optimize:clear
artisan config:cache
artisan route:cache
artisan icons:cache
artisan view:cache

@eelco2k
Copy link
Author

eelco2k commented Oct 24, 2024

yep okay. i'm going to check if getBoltFormDesigner() exists..

@eelco2k
Copy link
Author

eelco2k commented Oct 24, 2024

dd($this->getBoltFormDesigner());
returns "null"

@eelco2k
Copy link
Author

eelco2k commented Oct 24, 2024

i'm not overriding anything. and the trait use Designer; exists in the FillForms.php

when i change it to this:

protected function getFormSchema(): array
    {

        $getDesignerClass = $this->getBoltFormDesigner() ?? $this;
        return $getDesignerClass::ui($this->zeusForm, $this->inline);
    }

i'm getting another error:

  LOG.error: Creation of dynamic property LaraZeus\Bolt\Livewire\FillForms::$placeholder-zeus-form-section is deprecated 

@eelco2k
Copy link
Author

eelco2k commented Oct 24, 2024

APP_ENV=local and enabled APP_DEBUG=true with barryvdh/laravel-debugbar enabled.

also when i try to use:

 return (new class { use Designer; })::ui($this->zeusForm, $this->inline);

i get :

Creation of dynamic property LaraZeus\Bolt\Livewire\FillForms::$placeholder-zeus-form-section is deprecated 

@eelco2k
Copy link
Author

eelco2k commented Oct 24, 2024

the second error can be fixed to add Attribute like this:

#[\AllowDynamicProperties]
class FillForms extends Component implements Forms\Contracts\HasForms

@eelco2k
Copy link
Author

eelco2k commented Oct 24, 2024

then everything works as expected even in other ENV with debugging enabled. Hope you can add these fixes soon :)

@atmonshi
Copy link
Member

bolt on "php": "^8.1",
I cant provide breaking changes now :)
but will do with v4 after filament v4 is available 👍

@eelco2k
Copy link
Author

eelco2k commented Oct 24, 2024

Got it. 👌🏻

@eelco2k eelco2k closed this as completed Oct 24, 2024
@eelco2k
Copy link
Author

eelco2k commented Oct 24, 2024

Perhaps using magic methods __get() and __set() can still be used for dynamic attributes.

@eelco2k
Copy link
Author

eelco2k commented Oct 24, 2024

    public array $dynamicProperties = [];

    public function __set(string $name, mixed $value)
    {
        if (property_exists($this, $name))
            $this->{$name} = $value;
        else
            $this->dynamicProperties[$name] = $value;
    }

    public function __get($property)
    {
        if (property_exists($this, $property))
            return $this->$property;
        else
            return $this->dynamicProperties[$property];
    }

@eelco2k eelco2k reopened this Oct 24, 2024
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

2 participants