Made changes as per Marco's comments

This commit is contained in:
MrCasual
2015-09-02 17:28:49 -04:00
parent e2775981af
commit c804e44961
6 changed files with 36 additions and 36 deletions

View File

@ -4,7 +4,7 @@ namespace MailPoet\Models;
if(!defined('ABSPATH')) exit;
class Segment extends Model {
public static $_table = MP_LISTS_TABLE;
public static $_table = MP_SEGMENTS_TABLE;
function __construct() {
parent::__construct();
@ -30,6 +30,6 @@ class Segment extends Model {
}
public function subscribers() {
return self::has_many_through(__NAMESPACE__ . '\Subscriber', __NAMESPACE__ . '\SubscriberSegment', 'list_id', 'subscriber_id');
return $this->has_many_through(__NAMESPACE__ . '\Subscriber', __NAMESPACE__ . '\SubscriberSegment', 'segment_id', 'subscriber_id');
}
}

View File

@ -15,7 +15,7 @@ class Subscriber extends Model {
));
}
public function lists() {
return self::has_many_through(__NAMESPACE__ . '\Segment', __NAMESPACE__ . '\SubscriberSegment', 'subscriber_id', 'list_id');
public function segments() {
return $this->has_many_through(__NAMESPACE__ . '\Segment', __NAMESPACE__ . '\SubscriberSegment', 'subscriber_id', 'segment_id');
}
}