class OgSelectionHandler extends EntityReference_SelectionHandler_Generic {

  [ ... ]

  public function buildEntityFieldQuery($match = NULL, $match_operator = 'CONTAINS') {
    global $user;

    $handler = EntityReference_SelectionHandler_Generic::getInstance($this->field, $this->instance, $this->entity_type, $this->entity);
    $query = $handler->buildEntityFieldQuery($match, $match_operator);

Given the class inherits from EntityReference_SelectionHandler_Generic, and AFAIK doesn't change its properties that were set in the constructor, would it not be simpler, quicker, and easier to read to call parent::buildEntityFieldQuery() rather than obtain an instance?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim’s picture

Status: Active » Needs review
FileSize
880 bytes

Let's see how this tests...

amitaibu’s picture

Thanks. Lets try to clean more cruft.

joachim’s picture

+++ b/plugins/entityreference/selection/OgSelectionHandler.class.php
@@ -164,12 +156,6 @@ class OgSelectionHandler extends EntityReference_SelectionHandler_Generic {
-  public function entityFieldQueryAlter(SelectQueryInterface $query) {
-    $handler = EntityReference_SelectionHandler_Generic::getInstance($this->field, $this->instance);
-    // FIXME: Allow altering, after fixing http://drupal.org/node/1413108
-    // $handler->entityFieldQueryAlter($query);
-  }
-
   /**

Oh I filed a separate issue for that one... #2218777: restore entityFieldQueryAlter()

Status: Needs review » Needs work

The last submitted patch, 2: 2218775-og-selection-handler-clean-2.patch, failed testing.