Skip to content

[Form] Collection ordering #8987

@trsteel88

Description

@trsteel88

I have a form with a collection of images. The user can re-order the images. I am using Doctrine2's Criteria for sorting the images.

    public function getImages()
    {
        $criteria = Criteria::create()
            ->orderBy(array('rank' => Criteria::ASC, 'id' => Criteria::ASC));

        return $this->images->matching($criteria);
    }

If the form is submitted and contains an error, the images are not loaded in the order submitted by the user. FYI, I am sorting the rank as a hidden field. The user drag/drops which updates the hidden rank in the html.

I am pretty sure this was working correctly when I found it here: #8315

The Criteria class should re-order the collection using logic, rather than a query since the query has already been run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy