taxonomy_select_nodes() would be a more useful API function if if supported the multi-term arguments from older versions of Drupal.

I'd like to see $tids = array(), $operator = 'or' restored to the arguments of the D7 version.

Issue fork drupal-607492

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jweowu’s picture

I'm struggling with the new DB abstraction with this one. Perhaps someone more knowledgeable could have a look?

It seems that $query = db_select('taxonomy_index', 't'); in taxonomy_select_nodes() creates a SelectQuery object, and the constructor for that explicitly sets the conjunction for its DatabaseCondition to 'AND' with $this->where = new DatabaseCondition('AND');

So although we could call $query->condition('tid', $tid); repeatedly for multiple term IDs, we'd need the conjunction to be 'OR' for it to return any values (as no row in the taxonomy_index table can have multiple different terms).

I don't see any API for replacing the DatabaseCondition (SelectQuery's private property $where) with another one with a different conjunction.

At this point, I'm wanting to resort to a normal SQL query to do this, so some help would be much appreciated.

poker10 made their first commit to this issue’s fork.