- Added new model "SubscriberList"

- Added has_many_through relations to the new model + Subscriber model
- Added tests
- Fixed syntax in other models
This closes #95
This commit is contained in:
MrCasual
2015-09-01 09:18:00 -04:00
parent e0ef01d9f8
commit 0015bdb617
9 changed files with 239 additions and 11 deletions

View File

@ -1,7 +1,7 @@
<?php
namespace MailPoet\Models;
if (!defined('ABSPATH')) exit;
if(!defined('ABSPATH')) exit;
class Subscriber extends Model {
public static $_table = MP_SUBSCRIBERS_TABLE;
@ -14,4 +14,8 @@ class Subscriber extends Model {
'isEmail' => __('Your email address is invalid.')
));
}
public function lists() {
return self::has_many_through(__NAMESPACE__ . '\SubscriberList', __NAMESPACE__ . '\PivotSubscriberList', 'subscriber_id', 'list_id');
}
}