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

Element $query->getCrtiteria() bug #7225

Closed
samhibberd opened this issue Dec 4, 2020 · 2 comments
Closed

Element $query->getCrtiteria() bug #7225

samhibberd opened this issue Dec 4, 2020 · 2 comments
Labels

Comments

@samhibberd
Copy link

Description

It doesn't look like the getCriteria() method picks up relatedTo criteria set by the field name eg.

$query->customFieldHandle(100);
vs
$query->relatedTo([ 'targetElement' => 100, 'field' =>'customFieldHandle' ]);

Steps to reproduce

// $criteria array does NOT contain any relatedTo criteria
$query = Entry::find();
$query->customFieldHandle(100);
$criteria = $query->getCriteria();
// $criteria array does contain the relatedTo criteria
$query = Entry::find();
$query->relatedTo([ 'targetElement' => 100, 'field' =>'customFieldHandle' ]);
$criteria = $query->getCriteria(); 

Additional info

  • Craft version: 3.5.16
  • PHP version: 7.3
@brandonkelly
Copy link
Member

Good catch! Just fixed this for the next release.

@brandonkelly
Copy link
Member

Craft 3.5.17 is out now with this fix.

brandonkelly added a commit that referenced this issue Dec 31, 2020
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