- Rebased master

- Cleaned up import & moved it under Subscribers menu
This commit is contained in:
MrCasual
2015-11-07 14:38:38 -05:00
parent 3f168d052f
commit b1ae07d38e
12 changed files with 546 additions and 316 deletions

View File

@ -94,6 +94,18 @@ class Segment extends Model {
}
}
static function filterWithSubscriberCount($orm) {
$orm = $orm
->selectMany(array(self::$_table.'.id', self::$_table.'.name'))
->select_expr('COUNT('.MP_SUBSCRIBER_SEGMENT_TABLE.'.subscriber_id)', 'subscribers')
->left_outer_join(
MP_SUBSCRIBER_SEGMENT_TABLE,
array(self::$_table.'.id', '=', MP_SUBSCRIBER_SEGMENT_TABLE.'.segment_id'))
->group_by(self::$_table.'.id')
->group_by(self::$_table.'.name');
return $orm;
}
static function createOrUpdate($data = array()) {
$segment = false;
@ -112,4 +124,4 @@ class Segment extends Model {
$segment->save();
return $segment;
}
}
}