Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bartram’s picture

Attached is a patch to use EFQ rather than SQL.

skwashd’s picture

Status: Active » Needs review

Marking as needs review so the test bot can check it.

Status: Needs review » Needs work

The last submitted patch, 1: patch_commit_8c684e8bb415.patch, failed testing.

skwashd’s picture

Thanks for the patch. It looks like it needs some work before it is ready to be committed. In addition to the test bot not being happy, there is some other stuff to fix.

  1. +++ b/uuid.entity.inc
    @@ -469,12 +469,21 @@ function entity_get_uuid_by_id($entity_type, $ids, $revision = FALSE) {
    +    $result = $query->execute();
    

    This can be chained like so:

    $query = new EntityFieldQuery();
    $result = $query->entityCondition(...)
      ->propertyCondition(...)
      ->execute();
    
  2. +++ b/uuid.entity.inc
    @@ -469,12 +469,21 @@ function entity_get_uuid_by_id($entity_type, $ids, $revision = FALSE) {
    +      return array_map(function ($entity) use ($uuid_key) { return $entity->$uuid_key;  }, $entities);
    

    nitpick - should only be a single space here.

mihai_brb’s picture

Status: Needs work » Needs review

We have the same problem with Mongo Node entities. EFQ seems to solve some cases where there is no base table, however we need to load the entity to get the UUID.
Would it be a solution to provide a hook here? For instance, for all Mongo Node entities we could hook in and run our own query in mongoDB and get exactly what is needed, without loading the entities.

Thanks,
Mihai

c_lehel’s picture

Issue summary: View changes
FileSize
4.26 KB

We reviewed the code, cleaned it up a bit. We also added fixes to the get_id_by_uuid function.

Status: Needs review » Needs work

The last submitted patch, 6: uuid_dbselect_to_EFQ_in_getter_functions_2238157_6.patch, failed testing.