Regarding patch #1722112: Autocomplete for entityreference fields :
I think that patch is incomplete: it supports "CONTAINS" search only for User entityreference fields but not for user autocomplete fields
In the 3rd block:
+ // User autocomplete fields.
+ elseif (!empty($string)) {
+ $query = db_select('users', 'u');
+ $query->leftJoin('realname', 'rn', 'u.uid = rn.uid');
+ $query->fields('u', array('uid', 'name'));
+ $query->condition(db_or()
+ ->condition('rn.realname', db_like($string) . '%', 'LIKE')
+ ->condition('u.name', db_like($string) . '%', 'LIKE')
+ );
you can clearly see that the resulting query will be "abcd%" , not "%abcd%", because the "%" is only added after. While in the same patch, in the previous IF (the one handling User autocomplete fields) the query is built like this:
->condition('rn.realname', '%' . db_like($string) . '%', 'LIKE')
Comments
Comment #2
pbattino commentedpatch added
Comment #3
hass commented