I stumbled upon an issue when using WdWrapperQueryResults for taxonomx_terms.
With this code
$term_result = MyCustomTaxonomyTermWrapperQuery::find()
->byName($myCondition)
->execute();
//assume that a term was found
$term = $term_result->current();
Now, inside current, you do
$current = $this->iterator->current();
$entity_info = entity_extract_ids($this->entityType, $current);
This is fine but $current only consists of a stdClass with [tid] => integer. So entity_extract_ids() throws EntityMalformedException since $current is not fully loaded. When dealing with node-like calls, this is not an issue.
I got around this issue by removing
return parent::current();
from WdTaxonomyTermWrapperQueryResults and replacing it with a customized version of current(), where I just do
$current = $this->iterator->current();
$current = taxonomy_term_load($current->{$this->entityInfo['entity keys']['id']});
$entity_info = entity_extract_ids($this->entityType, $current);
//parent current code continues
I'm not sure if this is the proper solution since a "regular" EntityFieldQuery returns the same result. So I assume this is by design. This seems a little "hack-ish" to me but I'm not sure how to solve the issue generic. I'm happy to provide a more generic patch but I don't know how to handle this without overriding the "current()" call.
Comments
Comment #3
zengenuity CreditAttribution: zengenuity at DrupalTutor / Zengenuity commentedThanks. I've committed this change.