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
e13557d3
Commit
e13557d3
authored
Jan 16, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc fix.
parent
31c24ec9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
ExistValidator.php
framework/validators/ExistValidator.php
+6
-1
No files found.
framework/validators/ExistValidator.php
View file @
e13557d3
...
...
@@ -100,7 +100,6 @@ class ExistValidator extends Validator
$targetClass
=
$this
->
targetClass
===
null
?
get_class
(
$object
)
:
$this
->
targetClass
;
$query
=
$this
->
createQuery
(
$targetClass
,
$params
);
/** @var \yii\db\ActiveRecordInterface $className */
if
(
!
$query
->
exists
())
{
$this
->
addError
(
$object
,
$attribute
,
$this
->
message
);
}
...
...
@@ -126,6 +125,12 @@ class ExistValidator extends Validator
return
$query
->
exists
()
?
null
:
[
$this
->
message
,
[]];
}
/**
* Creates a query instance with the given condition.
* @param string $targetClass the target AR class
* @param mixed $condition query condition
* @return \yii\db\ActiveQueryInterface the query instance
*/
protected
function
createQuery
(
$targetClass
,
$condition
)
{
/** @var \yii\db\ActiveRecordInterface $targetClass */
...
...
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