Skip to content
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

Error when using orderBy('RAND()') as criteria #32

Closed
ryanfoote opened this issue Mar 23, 2021 · 1 comment
Closed

Error when using orderBy('RAND()') as criteria #32

ryanfoote opened this issue Mar 23, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@ryanfoote
Copy link

Describe the bug

When orderBy('RAND()') is used as a criteria, Craft produces the following error:

Array to string conversion

To reproduce

Apply orderBy('RAND()') to the criteria, like so:

{% set queryCriteria = craft.entries.limit(1).orderBy('RAND()') %}
{% set relatedContent = craft.similar.find({element: entry, context: entry.category, criteria: queryCriteria}) %}

Expected behaviour

That the plugin would return a randomized set of entries.

Screenshots

Screen Shot 2021-03-23 at 4 49 41 PM

Versions

  • Plugin version: 1.1.2
  • Craft version: 3.6.11
@ryanfoote ryanfoote added the bug Something isn't working label Mar 23, 2021
khalwat added a commit that referenced this issue Mar 27, 2021
Signed-off-by: Andrew Welch <andrew@nystudio107.com>
@khalwat
Copy link
Contributor

khalwat commented Mar 27, 2021

Fixed in https://github.com/nystudio107/craft-similar/releases/tag/1.1.3

@khalwat khalwat closed this as completed Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants