0

So, I'm pretty new to drupal(7) - any help here greatly appreciated.

What I'm trying to do is use entityFieldQuery to return a list of nodes that have a given term in them.

I have a field, "field_crafts", where crafts is a term reference, and points to a specific vocabulary. I also have a 'tags' field.

If I use fieldCondition('field_tags', 'tid', $n), the entityFieldQuery works fine, and returns all nodes with the given tag.

But if I do the very same thing on field_crafts instead, it returns no results.

I've poked around in my database, and it appears that field_data_field_tags table has data in it, but the field_data_field_crafts does not. However, the field_revision_field_crafts table does. And when I load up the node in the UI, it does indeed remember which terms I have ticked in the list of checkboxes.

So, what's going on here? I imagine that if the crafts data were just to appear in the data table, the query would work fine. Why isn't it, and is there anything I can do?

Thanks!

1
  • So, having moved on to other things on my site, it seems like none of my entityFieldQueries are returning the most recent revision of the entity, they instead use the oldest -- presumably this is really where the problem lies. But how to fix it...? Commented Sep 27, 2014 at 15:13

1 Answer 1

0

So, I figured out what was going on -- I was using the 'moderation' plugin and so all the changes I was making were secretly getting marked as 'draft' despite me making the changes as an admin. Doh.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.