Opened 2 years ago
Closed 2 years ago
#2866 closed Defect (worksforme)
elgg_get_river - aborts on relationship query, generating invalid SQL
| Reported by: | dannyl | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Needs Review |
| Component: | Core | Version: | Github Master |
| Severity: | major | Keywords: | |
| Cc: | brett@… | Difficulty: |
Description
Running the 1.8 trunk from Feb 8,2011.
elgg_get_river generates invalid SQL and aborts under following conditions:
Calling sequence:
$optionstype? = 'object';
$optionssubtype? = $content;
$optionsrelationship? = 'friend';
$optionsinverse_relationship? = true;
$optionsrelationship_guid? = get_loggedin_userid();
$items = elgg_get_river($options);
Emits invalid SQL referencing a column "e.GUID" that doesn't exist
SELECT count(DISTINCT rv.id) as total FROM elgg_river rv JOIN elgg_entity_relationships r on r.guid_one = e.guid WHERE ((rv.type = 'object') AND (rv.subtype = 'groupforumtopic')) AND (r.relationship = 'friend' AND r.guid_two = '3') AND ( (1 = 1) )
Change History (2)
comment:1 Changed 2 years ago by dannyl
comment:2 Changed 2 years ago by cash
- Resolution set to worksforme
- Status changed from new to closed
- Version changed from 1.8 Beta to SVN Trunk
tried this with the latest in svn and it worked:
$options = array( 'type' => 'object', 'subtype' => 'blog', 'relationship' => 'friend', 'inverse_relationship' => true, 'relationship_guid' => get_loggedin_userid(), ); $items = elgg_get_river($options);
The type and subtype are stored in the river table for the object entity. If it doesn't work for you on clean svn checkout, please reopen.

The code needs to add the elgg_entities e table reference clause as in