Listing & form
- improved Listing in order to make it more DRY - form builder with all field types - added support for data array in ValidModel->set() - updated models to comply with Listing & Form methods
This commit is contained in:
@@ -80,10 +80,18 @@ class Subscriber extends Model {
|
||||
|
||||
if($subscriber === false) {
|
||||
$subscriber = self::create();
|
||||
$subscriber->hydrate($data);
|
||||
} else {
|
||||
unset($data['id']);
|
||||
$subscriber->set($data);
|
||||
}
|
||||
|
||||
$subscriber->hydrate($data);
|
||||
return $subscriber->save();
|
||||
$saved = $subscriber->save();
|
||||
|
||||
if($saved === false) {
|
||||
return $subscriber->getValidationErrors();
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user