It isn’t a big deal, but is there a simple way to do this - like a load_all_related() function or somesuch so I don’t have to load up each one individually?
There isn’t a built-in function for this. It would be super-easy to handle this through an extension.
The basic idea would be something like this:
function load_all_related($object, $has_many = TRUE, $has_one = TRUE) {
$rel = array();
if($has_one) {
$rel = array_keys($object->has_one);
}
if($has_many) {
$rel = $rel + $object->has_many;
}
foreach($rel as $related) {
$object->{$related}->get();
}
}
Package that up in an extension class, and you can use it anywhere.
@benoa, Benedikt
I’m sorry that you feel that a 100% free library should provide better support. I don’t write DMZ to make money, and I don’t have a lot of free time. The questions you were asking are fairly basic questions that are easily answered. I recently added searching to help find answers, as well.
Another reason I am a little short with Benedikt specifically is that your first communication with me was through my business email address. Not only is there a forum for asking questions, but I have an email address in the manual specifically for DMZ-related questions. Contacting me through my business email shows me that you have not read the manual, much less looked for answers to your question.
You say “How can I create a model?” I say there is a Getting Started page, a page labeled Models, and an entire example application in the manual.
If you look through the (very long) previous thread, you will see I provide a lot of support. I answer a lot of questions, and I fix bugs as they are found.
