the attached patch adds a read-only "parents_all" property for taxonomy terms

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fago’s picture

Patch looks good and is certainly useful in conjunction with Rules or Search API. However, entity-property-info is supposed to denote properties of the entity, not any computed properties...

Still, we already have some computed properties like stuff that has been converted from tokens like node:edit_url or comment-count for a node. We also have some reverse-relationship properties that do not really exist directly on the entity.

However, the patch takes that this further. Going that way we might end up defining all data we have about an entity as entity-properties, which is certainly performance relevant for modules like rest_ws that just want to take *all* entity properties.

So meet both requirements, perhaps we should just denote that some properties are computed by using a 'computed' => TRUE key? So modules like rest-ws could choose (or implement an option) to hide/show computed properties too.

klausi’s picture

Interesting. One could argue that the term parents are not properties of a term (strictly speaking), but I don't see any drawbacks here.

fago’s picture

Title: Support taxonomy_get_parents_all » Support computed properties like taxonomy_get_parents_all?
Status: Needs review » Needs work

Setting to needs-work until we've solved that issue.

fago’s picture

We should figure out how to deal with computed stuff before the release.

klausi’s picture

I agree with the suggestion from #1 to introduce a "computed" key (defaulting to FALSE) to indicate such virtual properties. This should help generic entity export modules like RESTWS to detect them and to ignore them.

fago’s picture

Status: Needs work » Needs review
FileSize
7.47 KB

ok, attached patch does so. Also fixed the parents-all property. Please review.

fago’s picture

Status: Needs review » Fixed

Committed.

Automatically closed -- issue fixed for 2 weeks with no activity.