Problem/Motivation

MyrestEntityLoaderInterface::getTermsByVid($vid, $sort) takes the name of a field to sort by and applies it to the query. Everything the loader returns then goes through a step that sorts it by weight, so for any entity type that has a weight - which taxonomy terms do - the argument has no effect at all.

A caller asking for terms sorted by name gets them sorted by weight and no indication that it did not get what it asked for. The signature is the documentation, and here the documentation is wrong.

Proposed resolution

  • Decide which of the two the method promises, and make it do that: either the requested sort survives the shared preparation step, or the argument goes and the method says it answers in the order the vocabulary is arranged in.
  • Whichever is chosen, cover it: a vocabulary whose weight order and name order differ is the only fixture the test needs, and the current behaviour passes no test at all.
  • Check the other readers of the loader for the same collision - the sorting step applies to everything it hands over, not only to terms.

Remaining tasks

Everything.

Issue fork myrest-3622920

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sergeydruua created an issue. See original summary.

  • sergeydruua committed e62cfb6e on 1.0.x
    Issue #3622920: List a vocabulary in the order it is arranged and drop...
sergeydruua’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

sergeydruua’s picture

Status: Fixed » Closed (fixed)