I just realized that i may not be following best practices in regards to the MVC pattern.
My issue is that my views "know" information about my database
Here's my situation in psuedo code...
My controller invokes a method from my model and passes it directly to the view
view.records = tableGateway.getRecords() // gets array of records
view.display()
in my view
each records as record
print record.name
print record.address
...
In my view i have record.name and record.address, info that's hard-coded to my database. Is this bad?
What other ways around it are there other than iterating over everything in the controller and basically rewriting the records collection. And that just seems silly.
Thanks
EDIT
Heres an actual view
<?php foreach( $categories as $category ): ?>
<tr>
<td><?php echo $category['name'] ?> </td>
<td><?php echo $category['fields'] ?> </td>
<td><?php echo $category['records'] ?></td>
<td><a href="/category/view/<?php echo $category['id'] ?>/<?php echo url::title( $category['name'] ) ?>/">View</a></td>
</tr>
<?php endforeach; ?>
So a simple loop through the data won't work, i need to capture certain fields of the sql result in my view.
Is there a way around this? It makes me feel dirty.