ENHANCEMENT Demo'ing model validation through Company->validate()

This commit is contained in:
Ingo Schommer 2012-03-14 17:20:25 +01:00
parent 4645195dd4
commit 95a1c51ca6

View File

@ -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() {