Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2_Queries.php |
— | — | @@ -597,8 +597,9 @@ |
598 | 598 | $query->jointable = $proptable->name; |
599 | 599 | |
600 | 600 | if ( $property->isInverse() ) { // see if we can support inverses by inverting the proptable data |
601 | | - if ( ( count( $proptable->objectfields ) == 1 ) && ( reset( $proptable->objectfields ) == 'p' ) ) { |
602 | | - $query->joinfield = $query->alias . '.' . reset( array_keys( $proptable->objectfields ) ); |
| 601 | + if ( ( count( $proptable->objectfields ) == 1 ) && ( $proptable->objectfields[0] == 'p' ) ) { |
| 602 | + $keys = array_keys( $proptable->objectfields ); |
| 603 | + $query->joinfield = $query->alias . '.' . $keys[0]; |
603 | 604 | $objectfields = array( 's_id' => 'p' ); |
604 | 605 | $valueindex = $labelindex = 3; // should normally not change, but let's be strict |
605 | 606 | } else { // no inverses supported for this property, stop here |