<h1><?php echo $parent->name; ?>'s puppies:</h1> <ul> <?php foreach ($parent->kids as $kid): ?> <li><?php echo $kid->name; ?> has <?php echo $kid->puppy->name; ?></li> <?php endforeach; ?> </ul>* Scenario 2: Pass the parent's name ($parent_name) as a string and the kids as an array ($kids). In the view...
<h1><?php echo $parent_name; ?>'s puppies</h1> <ul> <?php foreach ($kids as $kid): ?> <li><?php echo $kid->name; ?> has <?php echo $kid->puppy->name; ?></li> <?php endforeach; ?> </ul>* Scenario 3: Pass parent's name as a string ($parent_name), kid names as an array ($kid_names), and puppy names as an array ($puppy_names). In the view...
<h1><?php echo $parent_name; ?>'s puppies</h1> <ul> <?php foreach ($kid_names as $key => $kid_name): ?> <li><?php echo $kid_name; ?> has <?php echo $puppy_names[$key]; ?></li> <?php endforeach; ?> </ul>
<p><?php echo $parent->delete(); ?><p>Or, because the ORM is so beautiful it doesn't know any better, echoing what you think are properties could actually be doing database operations directly in your views. If for instance, you hadn't set/hydrated a Model_Parent's kid or puppy before passing the model to the view.
<p><?php echo $parent->kid->puppy->name; ?><p>All in all, I'm not sure how big of a deal those two issues might be. At this point, I need to write it quicker more than I need to write it perfect. Objects it is!
It looks like you're new here. If you want to get involved, click one of these buttons!