How do I efficiently load multiple has_many relationships in CodeIgniter DataMapper ORM?
问题 Given the following models: Category: has_many(‘template’) Template: has_many(‘tag’, ‘procedure’) What is the most efficient way to load ALL objects related to ALL categories? For instance, I’m currently doing the following, but hopefully there is a better way: // Load all Category objects $categories = new Category(); $categories->get(); // Load all Template objects related to each Category foreach($categories as $category) { $category->templates->get(); // Load all the Tag and Procedure