I am not a fan of writing long SQL queries and I am a huge fan of Views. When I need a list of nodes, for example for processing nodes in a cron task, I create a view and use views_get_view_result()
to get the items and process them.
In Drupal 7, I think views_get_view_result()
returned the node ID and other fields. In Drupal 8, it seems to be also including the fully loaded node object. Although this is very handy, as in most cases I am likely going to need the node object. Is this very memory efficient? Is passing hundreds or thousands of fully loaded node objects not going to cause memory issues?
Is there a way to only get node IDs and then let me use them to call Node::load()
?