Files
piratepoet/lib/Models/Subscriber.php
Vlad 12bead358c - Added Sudzy composer dependency for model validation
- All models now extend a generic Model class that extends Sudzy
- Wrote tests for Subscriber and Setting model validation
- Rewrote model tests to make sure they look the same
- Updated both tests with cleanup logic in the beginning
- Added test:unit-single method to Robo for selective unit testing

Closes #54
2015-08-11 23:52:00 +00:00

33 lines
735 B
PHP

<?php
namespace MailPoet\Models;
if (!defined('ABSPATH')) {
exit;
}
class Subscriber extends Model {
public static $_table = MP_SUBSCRIBERS_TABLE;
function __construct() {
$this->addValidations(
'email',
array('required' => "validation_email_blank",
'isEmail' => "validation_email_invalid"
)
);
$this->addValidations(
'first_name',
array('required' => "validation_first_name_blank",
'minLength|2' => "validation_first_name_length"
)
);
$this->addValidations(
'last_name',
array('required' => "validation_last_name_blank",
'minLength|2' => "validation_last_name_length"
)
);
}
}