Skip to content

BC break in LiveComponentHydrator #2888

Open
@1ed

Description

@1ed

There is a BC break in LiveComponentHydrator as it now throws an exception when dehydrating a User entity class extending UserInterface.

Image

Image

In \Symfony\UX\LiveComponent\LiveComponentHydrator::dehydrateObjectValue the $classType parameter value is the interface not the class as it was before (in LegacyLivePropMetadata).

The component looks like this:

<?php

declare(strict_types=1);

namespace App\Component;

use App\Controller\BaseController;
use App\Entity\User;
use App\Form\Type\UserAdminType;
use Symfony\Component\Form\FormInterface;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
use Symfony\UX\LiveComponent\Attribute\LiveProp;
use Symfony\UX\LiveComponent\ComponentWithFormTrait;
use Symfony\UX\LiveComponent\DefaultActionTrait;

#[AsLiveComponent('user_admin_form')]
final class UserAdminForm extends BaseController
{
    use DefaultActionTrait;
    use ComponentWithFormTrait;

    #[LiveProp]
    public User $user;

    protected function instantiateForm(): FormInterface
    {
        return $this->createForm(UserAdminType::class, $this->user, ['is_edit' => true]);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions