Following the Developer documentation here is it possible to go further and filter the results by the object's attributes?
For example, say you had multiple boats in a Marina that had the same owner and you wanted to find only that owner's boats in the Marina is there a way of filtering the data down further (ie filter by the attribute BoatOwner).
After much reading of the Doctrine2 documentation I can understand that this can be done but I can't work out how to extend the C5 code or what methods I can call to do this.
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); ?>
<?php
if (isset($entry) && is_object($entry)) {
$boats = $entry->getBoats();
?>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Year</th>
<th>Owner</th>
<th>Classification</th>
</tr>
</thead>
<tbody>
<?php if (count($boats)) {
foreach($boats as $boat) { ?>
<tr>
<td><?=$boat->getBoatName()?></td>
<td><?=$boat->getBoatYear()?></td>
<td><?=$boat->getBoatOwner()?></td>
<td><?=$boat->getBoatClass()?></td>
</tr>
<?php } ?>
<?php } else { ?>
<tr>
<td colspan="4">No boats found.</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
The above is the code from the C5 documentation. Can the magic "get" method be extended in some way or is there a simpler solution working with the $boats array (I think it's an array) to select only the boats with a certain attribute value?
The answer was to place an if statement with the foreach loop.
I'm thinking I will pass the boat owner's name as a variable probably from page attribute for this to be of any use.