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
8c8a3898
Commit
8c8a3898
authored
Jun 17, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #3772: Behaviors adding validation rules do not work as expected
parent
a252622d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
Model.php
framework/base/Model.php
+12
-10
No files found.
framework/CHANGELOG.md
View file @
8c8a3898
...
...
@@ -44,6 +44,7 @@ Yii Framework 2 Change Log
-
Bug #3751: Fixed postgreSQL schema data for enum values, do not add values if there are none (makroxyz)
-
Bug #3752:
`QueryBuilder::batchInsert()`
does not typecast input values (qiangxue)
-
Bug #3756: Fix number formatting error for
`\yii\base\Formatter`
by converting strings to float (kartik-v)
-
Bug #3772: Behaviors adding validation rules do not work as expected (qiangxue)
-
Bug #3817:
`yii\rbac\PhpManager::getChildren()`
returns null instead of expected empty array (qiangxue)
-
Bug #3843: Fixed Menu bug when using
`template`
with
`encodeLabel`
=> false (creocoder, umneeq)
-
Bug #3863: Fixed incorrect js selector for
`\yii\widgets\ActiveForm::errorSummaryCssClass`
when it contains multiple classes (creocoder, umneeq)
...
...
framework/base/Model.php
View file @
8c8a3898
...
...
@@ -310,28 +310,30 @@ class Model extends Component implements IteratorAggregate, ArrayAccess, Arrayab
*/
public
function
validate
(
$attributeNames
=
null
,
$clearErrors
=
true
)
{
if
(
$clearErrors
)
{
$this
->
clearErrors
();
}
if
(
!
$this
->
beforeValidate
())
{
return
false
;
}
$scenarios
=
$this
->
scenarios
();
$scenario
=
$this
->
getScenario
();
if
(
!
isset
(
$scenarios
[
$scenario
]))
{
throw
new
InvalidParamException
(
"Unknown scenario:
$scenario
"
);
}
if
(
$clearErrors
)
{
$this
->
clearErrors
();
}
if
(
$attributeNames
===
null
)
{
$attributeNames
=
$this
->
activeAttributes
();
}
if
(
$this
->
beforeValidate
())
{
foreach
(
$this
->
getActiveValidators
()
as
$validator
)
{
$validator
->
validateAttributes
(
$this
,
$attributeNames
);
}
$this
->
afterValidate
();
return
!
$this
->
hasErrors
();
foreach
(
$this
->
getActiveValidators
()
as
$validator
)
{
$validator
->
validateAttributes
(
$this
,
$attributeNames
);
}
$this
->
afterValidate
();
return
false
;
return
!
$this
->
hasErrors
()
;
}
/**
...
...
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