BambooInvoice Forums

business logic in the clients index view.

 
Total Posts: 3

Hi,

I found business logic in the clients index view.


32 <?php foreach($all_clients->result() as $client): ?>
[snip]
43         <?php
44           // client contact information
45           $this->db->where(‘client_id’, $client->id);
46           $this->db->orderby(“last_name”, “first_name”);
47           $clientContacts = $this->db->get(‘clientcontacts’);
48           $clientContactCount = $clientContacts->num_rows();
         

In which model class should this be encapsulated? Clients with a join? or Clientcontacts?

I suggest to move this business logic out of the view and to encapsulate it in a new method: clientcontacts_model::getClientContacts($client_id);

That’s the easiest and most straightforward solution i can think of.

Thanks in advance