Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
62fd92bf
Commit
62fd92bf
authored
Apr 03, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
validator wip
parent
0e8e94bc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
BooleanValidator.php
framework/validators/BooleanValidator.php
+9
-0
Validator.php
framework/validators/Validator.php
+7
-1
No files found.
framework/validators/BooleanValidator.php
View file @
62fd92bf
...
@@ -60,6 +60,15 @@ class BooleanValidator extends Validator
...
@@ -60,6 +60,15 @@ class BooleanValidator extends Validator
}
}
}
}
public
function
validateValue
(
$value
)
{
if
(
$this
->
allowEmpty
&&
$this
->
isEmpty
(
$value
))
{
return
;
}
return
(
$this
->
strict
||
$value
==
$this
->
trueValue
||
$value
==
$this
->
falseValue
)
&&
(
!
$this
->
strict
||
$value
===
$this
->
trueValue
||
$value
===
$this
->
falseValue
);
}
/**
/**
* Returns the JavaScript needed for performing client-side validation.
* Returns the JavaScript needed for performing client-side validation.
* @param \yii\base\Model $object the data object being validated
* @param \yii\base\Model $object the data object being validated
...
...
framework/validators/Validator.php
View file @
62fd92bf
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
namespace
yii\validators
;
namespace
yii\validators
;
use
yii\base\Component
;
use
yii\base\Component
;
use
yii\base\NotSupportedException
;
/**
/**
* Validator is the base class for all validators.
* Validator is the base class for all validators.
...
@@ -81,7 +82,7 @@ abstract class Validator extends Component
...
@@ -81,7 +82,7 @@ abstract class Validator extends Component
*/
*/
public
$message
;
public
$message
;
/**
/**
* @var array list of scenarios that the validator
should be applied
.
* @var array list of scenarios that the validator
can be applied to
.
*/
*/
public
$on
=
array
();
public
$on
=
array
();
/**
/**
...
@@ -174,6 +175,11 @@ abstract class Validator extends Component
...
@@ -174,6 +175,11 @@ abstract class Validator extends Component
}
}
}
}
public
function
validateValue
(
$value
)
{
throw
new
NotSupportedException
(
__CLASS__
.
' does not support validateValue().'
);
}
/**
/**
* Returns the JavaScript needed for performing client-side validation.
* Returns the JavaScript needed for performing client-side validation.
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment