I am running Entity Reference and Content Access on my site.. In order for non-superusers to be able to create content I had to apply the following patch to entity.inc..


The issue is that with this patch I am not able to reference users with entity reference because it gives the following error..

Recoverable fatal error: Method DatabaseCondition::__toString() must return a string value in EntityReferenceHandler_user->entityFieldQueryAlter() (line 289 of C:\wamp\www\2012-01-12\sites\all\modules\entityreference\handler\base.inc).

Reverting to the unpatched entity.inc file gets user references working but obviously returns the first issue..

Anyone have any ideas?


#8 1410306-entityreference-robust-query-alteration.patch2.06 KBDamien Tournoud
#2 forum_ui_imporvements1.patch904 bytesindrek02
FAILED: [[SimpleTest]]: [MySQL] Invalid patch format in forum_ui_imporvements1.patch. View
Members fund testing for the Drupal project. Drupal Association Learn more


shadysamir’s picture

Title: Cannot reference users with patched entity.inc. » Error with user reference
Version: 7.x-1.0-beta3 » 7.x-1.x-dev
Category: support » bug

The error appears for me on latest dev (not sure if patch mentioned above has been committed) when I try to fill a user reference field.

Recoverable fatal error :Method DatabaseCondition::__toString() must return a string value in EntityReference_SelectionHandler_Generic_user->entityFieldQueryAlter()

indrek02’s picture

Status: Active » Patch (to be ported)
904 bytes
FAILED: [[SimpleTest]]: [MySQL] Invalid patch format in forum_ui_imporvements1.patch. View

Bug still exists in rc3.
Made a patch that will prevent a fatal error.
Not sure if this is the correct fix for it.

cangeceiro’s picture

Priority: Normal » Major
Status: Patch (to be ported) » Reviewed & tested by the community

I also got this error message with entityreference out of the box. Patch above resolved the issue.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, forum_ui_imporvements1.patch, failed testing.

mrfelton’s picture

Patch stops the error, but doesn't make the user reference field work.

mrfelton’s picture

In my case, editing and resaving the broken entityreference field resolved the issue. I think the field was created on a much earlier version of entityreference and exported to a feature. The code in the feature was out of sync with what the latest version of entityreference expects to see.

JohnnyX’s picture

Maybe also a issue with user reference...

autocomplete should not show

1) "guest" (autocomplete deluxe widget)
2) "guest" and "none" (chosen widget)

"guest" und "none" shouldn't be added to the selected referenced users. Guest will also be saved.
Or should it filtered an other way...?

Damien Tournoud’s picture

Status: Needs work » Fixed
2.06 KB

I merged the attached in 7.x-1.x. This should fix the error displayed here.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.