10000 [Form] Collection ordering · Issue #8987 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
8000

[Form] Collection ordering #8987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
trsteel88 opened this issue Sep 11, 2013 · 1 comment
Closed

[Form] Collection ordering #8987

trsteel88 opened this issue Sep 11, 2013 · 1 comment
Labels

Comments

@trsteel88
Copy link
Contributor

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.

@webmozart
Copy link
Contributor

Duplicate of #4492

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants
0