8000 PersistentCollection::matching() does not respect the collections native sorting · Issue #7767 · doctrine/orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
PersistentCollection::matching() does not respect the collections native sorting #7767
Closed
@stephanschuler

Description

@stephanschuler

Bug Report

When PersistentCollection::matching() is called, the result in terms of sorting depends on the collection being initialized or uninitialized.

Q A
BC Break no
Version 2.5

Summary

On an initialized collection, the "matching" is applied to the array content, which means sorting is basically untouched if the criteria does not provide additional sorting.

On an unitialized collection, the "matching" is queried through the database. Here the sorting of the collection isn't considered, only the sorting of the criteria is. More often than not, no predictable sorting is used here -- whenever the criteria comes without custom sorting.

Current behavior

PersistentCollection->matching(Criteria::create()) without sorting doesn't use the collections sorting either.

How to reproduce

  • Used the Ecommerce category as a test case.
  • Make Category::$children @ORM/OrderBy({"name" = "ASC"})
  • Fill unordered data
  • As for $category->getChildren()->matching(Criteria::create()).

The result is not ordered according to the annotation.

Expected behavior

The result should be ordered according to the annotation.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0