diff --git includes/database/pgsql/query.inc includes/database/pgsql/query.inc index 8825229..a60e6b9 100644 --- includes/database/pgsql/query.inc +++ includes/database/pgsql/query.inc @@ -189,4 +189,19 @@ class SelectQuery_pgsql extends SelectQuery { return $this; } + /** + * Overrides SelectQuery::orderBy(). + * + * Automatically adds columns that are ordered on as fields. + */ + public function orderBy($field, $direction = 'ASC') { + $return = parent::orderBy($field, $direction); + if (strpos($field, '.') !== FALSE) { + list($table, $field) = explode('.', $field); + $this->addField($table, $field); + } + return $return; + } + + } diff --git modules/simpletest/tests/entity_query.test modules/simpletest/tests/entity_query.test index f1c9e64..5890cb7 100644 --- modules/simpletest/tests/entity_query.test +++ modules/simpletest/tests/entity_query.test @@ -501,16 +501,20 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase { $query = new EntityFieldQuery(); $query ->entityCondition('entity_type', 'test_entity_bundle_key') - ->propertyCondition('ftid', 1, 'CONTAINS'); + ->propertyCondition('fttype', 'und', 'CONTAINS'); $this->assertEntityFieldQuery($query, array( array('test_entity_bundle_key', 1), + array('test_entity_bundle_key', 2), + array('test_entity_bundle_key', 3), + array('test_entity_bundle_key', 4), + array('test_entity_bundle_key', 5), + array('test_entity_bundle_key', 6), ), t('Test the "contains" operation on a property.')); $query = new EntityFieldQuery(); - $query->fieldCondition($this->fields[0], 'value', 3, 'CONTAINS'); + $query->fieldCondition($this->fields[1], 'shape', 'uar', 'CONTAINS'); $this->assertEntityFieldQuery($query, array( - array('test_entity_bundle_key', 3), - array('test_entity', 3), + array('test_entity_bundle', 5), ), t('Test the "contains" operation on a field.')); $query = new EntityFieldQuery();