Skip to content

Fixed order based on slug #190

Closed
Closed
@thunder87

Description

@thunder87

Description

Unable to order entries based on the order the slugs are received.

Steps to reproduce

  1. Copy below entries.json and view the entries.json output in the browser.
  2. Order will be the same regardless of how the slugs are ordered.

Additional info

return [
    'endpoints' => [
        'entries.json' => function() {
            $slugs = Craft::$app->getRequest()->getRequiredQueryParam('slugs');

              return [
                  'elementType' => Entry::class,
                  'criteria' => [
                      'slug' => $slugs
                  ],
                  'transformer' => function (Entry $entry) {
                      return [
                          "title" => $entry->title,
                      ];
                  },
              ];
        }
    ]
]
  • Craft version: 4.9.0
  • PHP version: 8.1.27
  • Database driver & version: MySQL 8.0.33
  • Plugins & versions: Element-api 4.1.0

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