Skip to content

Instantly share code, notes, and snippets.

@objectivehtml
Created December 4, 2012 20:24
Show Gist options
  • Select an option

  • Save objectivehtml/4208306 to your computer and use it in GitHub Desktop.

Select an option

Save objectivehtml/4208306 to your computer and use it in GitHub Desktop.
Joining another table to an channel entries using Channel Data
class Showtimes_model extends CI_Model {
public function get_showtimes($params = array())
{
$default_params = array(
'select' => array(
'count(exp_showtimes.id) as \'total_showtimes\'',
'showtimes.*'
),
'join' => array(
'showtimes' => 'channel_data.entry_id = showtimes.entry_id'
),
'group_by' => 'showtimes.entry_id'
);
$params = array_merge($default_params, $params);
return $this->channel_data->get_entries($params);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment