Skip to content

[Live] Fix problems with CollectionType Demo & unpersisted TodoList #740

@weaverryan

Description

@weaverryan

In the unreleased 2.8 version, you are now allowed to have non-persisted entities on a LiveProp. We need to update https://ux.symfony.com/live-component/demos/form-collection-type to show this off, which means ALWAYS passing in the todoList to the component.

Doing this locally exposes a few problems:

  1. When TodoList is dehydrated (via the serializer), it fails due to a circular reference (TodoList -> TodoItem -> TodoList)
  2. When that's fixed, on the first Ajax call, the dehydrated data fails to set due to type problems. For example, TodoList::setName() accepts a string argument, but the object deserialized to null initially.
  3. If we empty the TodoList (by default we put one item into it), we hit a checksum problem due to how the empty ArrayCollection is dehydrated.

Let's also check the case where the ArrayCollection is initialized to a few saved entities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugBug Fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions