2017 © Pedro Peláez
 

silverstripe-module silverstripe-valitron

Better SilverStripe DataObject Validation With Valitron

image

jinjie/silverstripe-valitron

Better SilverStripe DataObject Validation With Valitron

  • Thursday, July 12, 2018
  • by jinjie
  • Repository
  • 1 Watchers
  • 0 Stars
  • 16 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Better Validation for SilverStripe

A very simple validation that make use of Valitron. Provides a helper that add error messages to form fields., (*1)

use SilverStripe\ORM\DataObject;
use SwiftDevLabs\Valitron\Helper;

class MyDataObject extends DataObject {
    // Validates DataObject
    public function validate()
    {
        $result = parent::validate();

        $v = new \Valitron\Validator([
            'Field1'    => $this->Field1,
            'Field2'    => $this->Field2,
        ]);

        // Find more rules at https://github.com/vlucas/valitron
        $v->rule('required', [
            'Field1',
            'Feild2',
        ]);

        return Helper::validate($v, $result);
    }
}

The Versions

12/07 2018

dev-ss3

dev-ss3

Better SilverStripe DataObject Validation With Valitron

  Sources   Download

MIT

The Requires

 

by Kong Jin Jie

12/07 2018

0.9

0.9.0.0

Better SilverStripe DataObject Validation With Valitron

  Sources   Download

MIT

The Requires

 

by Kong Jin Jie

11/07 2018

dev-master

9999999-dev

Better SilverStripe DataObject Validation With Valitron

  Sources   Download

MIT

The Requires

 

by Kong Jin Jie

11/07 2018

1.0.0

1.0.0.0

Better SilverStripe DataObject Validation With Valitron

  Sources   Download

MIT

The Requires

 

by Kong Jin Jie