commit 5696b36e4b0d840d31cfbfd0a01eebc2088b9394 (HEAD, 7.x-1.x)
Author: Howard Tyson <howard@howardtyson.com>
Date:   Thu Dec 1 11:03:46 2011 -0800

    Issue #1444458 by tim.plunkett: Fixed author filtering can cause loading of every entity.

diff --git a/plugins/entityreference/selection/EntityReferenceHandler_field.class.php b/plugins/entityreference/selection/EntityReferenceHandler_field.class.php
index 6b7874b..843ea5a 100644
--- a/plugins/entityreference/selection/EntityReferenceHandler_field.class.php
+++ b/plugins/entityreference/selection/EntityReferenceHandler_field.class.php
@@ -77,41 +77,6 @@ class EntityReferenceHandler_field extends EntityReference_SelectionHandler_Gene
     return $instance;
   }
 
-
-  /**
-   * Implements EntityReferenceHandler::getReferencableEntities().
-   */
-  public function getReferencableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
-    $options = array();
-    $entity_type = $this->field['settings']['target_type'];
-
-    $query = $this->buildEntityFieldQuery($match, $match_operator);
-    if ($limit > 0) {
-      $query->range(0, $limit);
-    }
-
-    $results = $query->execute();
-
-    if (!empty($results[$entity_type])) {
-      $options = $results[$entity_type];
-      $entities = entity_load($entity_type, array_keys($options));
-      foreach ($entities as $entity_id => $entity) {
-        $settings = $this->field['settings']['handler_settings'];
-        // Entity field query is incapable of querying the entity's actual
-        // table so here we skip adding this item to the results if the author_only
-        // setting has been set and the item was not authored by the user.
-        if (isset($settings['author_only']) && $settings['author_only']) {
-          global $user;
-          if ($user->uid != $entity->uid) {
-            unset($options[$entity_id]);
-          }
-        }
-        $options[$entity_id] = $this->getLabel($entity);
-      }
-    }
-    return $options;
-  }
-
   /**
    * Build an EntityFieldQuery to get referencable entities.
    */
@@ -130,6 +95,11 @@ class EntityReferenceHandler_field extends EntityReference_SelectionHandler_Gene
       $query->fieldCondition($search_field, NULL, NULL, '<>');
     }
 
+    if (isset($settings['author_only']) && $settings['author_only']) {
+      global $user;
+      $query->propertyCondition('uid', $user->uid, '=');
+    }
+
     return $query;
   }
 
