ActiveRecord\Errors::is_empty PHP Method

is_empty() public method

Returns true if there are no error messages.
public is_empty ( ) : boolean
return boolean
    public function is_empty()
    {
        return empty($this->errors);
    }

Usage Example

Example #1
0
 /**
  * Validates the model.
  *
  * @return boolean True if passed validators otherwise false
  */
 private function _validate()
 {
     $validator = new Validations($this);
     $validation_on = 'validation_on_' . ($this->is_new_record() ? 'create' : 'update');
     foreach (array('before_validation', "before_{$validation_on}") as $callback) {
         if (!$this->invoke_callback($callback, false)) {
             return false;
         }
     }
     $this->errors = $validator->validate();
     foreach (array('after_validation', "after_{$validation_on}") as $callback) {
         $this->invoke_callback($callback, false);
     }
     if (!$this->errors->is_empty()) {
         return false;
     }
     return true;
 }