Skip to content

[LiveComponent] sensio/framework-extra-bundle will make your app fail under certain circumstances #865

Closed
@Jim56450

Description

@Jim56450

Hi !

Imagine you create a brand new project using :

symfony new test_live_components --version="6.2.*" --webapp

It installs by default the sensio/framework-extra-bundle.

Now add the symfony/ux-live-component package to your project.

Now, create your components (the one I used was similar to the the Product Form + Category modal).

It uses the Category type-hint between NewCategoryForm.php

$this->emit('category:created', [
            'category' => $category->getId(),
        ]);

and NewProductForm.php

#[LiveListener('category:created')]
 public function onCategoryCreated(#[LiveArg] Category $category): void
{

    $this->category = $category;   
}

The problem is there is a big chance you encounter an 'Unable to guess how to get a Doctrine instance from the request information for parameter "category"' exception when 'onCategoryCreated' is executed. This is because of the presence of sensio/framework-extra-bundle.

You have to remove it to make all this work.

composer remove sensio/framework-extra-bundle

It will work now and hope it will be useful to anybody, avoiding time to debug.

Maybe this could be added to the doc ?

Unfortunately, this doesn't solve the problems exposed here

Thanks for reading,

Marc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions