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] Select2 in repeatable is lazy loading #25

Open
Rian190 opened this issue Dec 5, 2023 · 1 comment
Open

[Bug] Select2 in repeatable is lazy loading #25

Rian190 opened this issue Dec 5, 2023 · 1 comment
Assignees

Comments

@Rian190
Copy link

Rian190 commented Dec 5, 2023

Bug report

What I did

I added a select2 in a repeatable.
And I activated the Model::preventLazyLoading() in the AppServiceProvider

   CRUD::addField([
            'type' => 'repeatable',
            'label' => 'Primary',
            'name' => 'Main',
            'subfields' => [
                [
                    'type' => 'select2',
                    'name' => 'relation',
                    'entity' => 'relation'
                ]
            ]
        ]);

What I expected to happen

The view should load as expected.

What happened

The Illuminate\ Database\ LazyLoadingViolationException exception is thrown

What I've already tried to fix it

??

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP VERSION:

PHP 8.2.11 (cli) (built: Oct 6 2023 09:47:18) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.11, Copyright (c) Zend Technologies
with Zend OPcache v8.2.11, Copyright (c), by Zend Technologies
with Xdebug v3.2.1, Copyright (c) 2002-2023, by Derick Rethans

LARAVEL VERSION:

10.33.0.0

BACKPACK PACKAGE VERSIONS:

backpack/basset: 1.2.2
backpack/crud: 6.3.2
backpack/filemanager: 3.0.6
backpack/generators: v4.0.2
backpack/logmanager: v5.0.1
backpack/permissionmanager: 7.1.1
backpack/pro: 2.0.18
backpack/revise-operation: 2.0.0
backpack/settings: 3.1.0
backpack/theme-coreuiv2: 1.2.2

@phpfour phpfour assigned phpfour and unassigned pxpm Dec 9, 2023
@phpfour
Copy link

phpfour commented Dec 9, 2023

Hi @Rian190

I have tried to reproduce the issue using our backpack demo but did not encounter it. Here's what I tried:

  1. Called Model::preventLazyLoading() in the AppServiceProvider:

CleanShot 2023-12-09 at 19 56 54

  1. Added a repeatable field in the App\Http\Controllers\Admin\DummyCrudController and commented out everything below it:

CleanShot 2023-12-09 at 19 56 18

  1. Opened up the dummy create form and found it to be working:

CleanShot 2023-12-09 at 19 55 01

Please let us know how we can help you debug this further.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs Testing, Review or Docs
Development

No branches or pull requests

3 participants