Search code examples
symfonydoctrine-ormcrudsymfony-formssymfony6

My edit (CRUD) function remove some DATA when I use it


i've a problem with symfony project, in my Controller Company when I use edit function to modif some DATA with embedded form, symfony keep only 1 customer (first one) and what I was change and remove all other DATA.

I not understand why symfony do that.

Thank U for Ure help

Best regards

Try to use edit function in symfony with embedded form


Solution

  • You're using the wrong function to render the customer (and network and process) subforms, use form_row(customer) instead of form(customer):

        {% for customer in form.customers %}
            <h6 class="mt-5">Client
                {{_key+1}}</h6>
            {{ form_row(customer) }}{% endfor %}