<p>I finally found that my problem was a SQL one not a CMS one. The where conditions grouping were the source of the problem. </p>

<p>Here is the final code I used.</p>

<p><a href="https://gist.github.com/nicolasbinet/7e3835b13c3e9c21d2fa754243242b41" rel="nofollow noreferrer">https://gist.github.com/nicolasbinet/7e3835b13c3e9c21d2fa754243242b41</a></p>

CC BY-SA 3.0
2017-06-14T19:45:30.253Z
2017-06-14T21:14:55.317Z
2017-06-14T21:14:55.317Z
Nicolas Binet
<p>I’m having a problem modifying an ElementCriteria with buildElementsQuery.
The results elements totally mixes locale results. I can only get english URL for example.</p>

<p>Here is a gist of my code.
<a href="https://gist.github.com/nicolasbinet/7e3835b13c3e9c21d2fa754243242b41" rel="nofollow noreferrer">https://gist.github.com/nicolasbinet/7e3835b13c3e9c21d2fa754243242b41</a></p>

<p>is there something particular to do when using buildElementQuery ?</p>

<p>Nicolas</p>

<elementcriteriamodel><query>
Trouble with buildElementQuery customization
# Trouble with buildElementQuery customization

(Asked by: username_0 on 2017-06-14)

I’m having a problem modifying an ElementCriteria with buildElementsQuery.
The results elements totally mixes locale results. I can only get english URL for example.

Here is a gist of my code.
<https://gist.github.com/nicolasbinet/7e3835b13c3e9c21d2fa754243242b41>

is there something particular to do when using buildElementQuery ?

Nicolas

**Tags:** elementcriteriamodel, query

---

## 1 answers

### Answer by username_0 on 2017-06-14. Score: 1

I finally found that my problem was a SQL one not a CMS one. The where conditions grouping were the source of the problem.

Here is the final code I used.

<https://gist.github.com/nicolasbinet/7e3835b13c3e9c21d2fa754243242b41>


---

