mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
ENHANCEMENT Demo'ing model validation through Company->validate()
This commit is contained in:
parent
4645195dd4
commit
95a1c51ca6
@ -29,7 +29,13 @@ class Company extends DataObject {
|
|||||||
|
|
||||||
public static $summary_fields = array('Name', 'Category', 'Revenue', 'CEO');
|
public static $summary_fields = array('Name', 'Category', 'Revenue', 'CEO');
|
||||||
|
|
||||||
|
function validate() {
|
||||||
|
if(!$this->Title) {
|
||||||
|
return new ValidationResult(false, 'Title is required');
|
||||||
|
} else {
|
||||||
|
return parent::validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function requireDefaultRecords() {
|
public function requireDefaultRecords() {
|
||||||
|
Loading…
Reference in New Issue
Block a user