summaryrefslogtreecommitdiff
path: root/includes/entity.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/entity.inc')
-rw-r--r--includes/entity.inc15
1 files changed, 12 insertions, 3 deletions
diff --git a/includes/entity.inc b/includes/entity.inc
index a3cdf7417..9ee7889cf 100644
--- a/includes/entity.inc
+++ b/includes/entity.inc
@@ -39,7 +39,8 @@ interface DrupalEntityControllerInterface {
* An array of conditions in the form 'field' => $value.
*
* @return
- * An array of entity objects indexed by their ids.
+ * An array of entity objects indexed by their ids. When no results are
+ * found, an empty array is returned.
*/
public function load($ids = array(), $conditions = array());
}
@@ -650,7 +651,11 @@ class EntityFieldQuery {
*/
public function fieldCondition($field, $column = NULL, $value = NULL, $operator = NULL, $delta_group = NULL, $language_group = NULL) {
if (is_scalar($field)) {
- $field = field_info_field($field);
+ $field_definition = field_info_field($field);
+ if (empty($field_definition)) {
+ throw new EntityFieldQueryException(t('Unknown field: @field_name', array('@field_name' => $field)));
+ }
+ $field = $field_definition;
}
// Ensure the same index is used for fieldConditions as for fields.
$index = count($this->fields);
@@ -752,7 +757,11 @@ class EntityFieldQuery {
*/
public function fieldOrderBy($field, $column, $direction = 'ASC') {
if (is_scalar($field)) {
- $field = field_info_field($field);
+ $field_definition = field_info_field($field);
+ if (empty($field_definition)) {
+ throw new EntityFieldQueryException(t('Unknown field: @field_name', array('@field_name' => $field)));
+ }
+ $field = $field_definition;
}
// Save the index used for the new field, for later use in field storage.
$index = count($this->fields);