error in taxonomy.getTree

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
ebhakt's picture

hi
i am using the services 2.x module and i am at the point where i need to get the vocab tree for a selected vid
what i noticed is that the return value for taxonomy.getTree doesnot containg the name of the vocabulary
it do contain the tid and taxonomy names and the respective vid's but nowhere there is a mention of vocabulary name

Isn't that a bug that should be taken care of ??

Comments

Taxonomy get tree

suganyaM's picture

Tables used by taxonomy module are:
term_data
term_hierarchy
term_node
term_relation
term_synonym
vocabulary
vocabulary_node_types

taxonomy_get_tree function return data from term_data and term_hierarchy tables. Inorder to include the vocablulary name in the return object, vocabulary table should also be joined to the above 2 tables. The mandatory paramenter vid to the taxonomy_get_tree() can be obtained by

  1. SELECT vid from {vocabulary} where name like '%s'", $vacabularyName).
  2. Explicitly hard coded.

If you use option 1, then you are aware of the vocabulary name before executing the function.

Refer taxonomy_get_tree

Taxonomy Related function list

All taxonomy get tree, willalways be tids. there has to another query to the bbb table to get the vocubulary name.

In case of repeady used taxonomy ids it is good practice to cache information appropriately since teh above queries could be expensive in larger database.

Newspapers on Drupal

Group organizers

Group categories

Topics - Newspaper on Drupal

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: