Files
piratepoet/lib/Models/Subscriber.php
MrCasual 0015bdb617 - 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
2015-09-01 09:18:00 -04:00

22 lines
571 B
PHP

<?php
namespace MailPoet\Models;
if(!defined('ABSPATH')) exit;
class Subscriber extends Model {
public static $_table = MP_SUBSCRIBERS_TABLE;
function __construct() {
parent::__construct();
$this->addValidations('email', array(
'required' => __('You need to enter your email address.'),
'isEmail' => __('Your email address is invalid.')
));
}
public function lists() {
return self::has_many_through(__NAMESPACE__ . '\SubscriberList', __NAMESPACE__ . '\PivotSubscriberList', 'subscriber_id', 'list_id');
}
}