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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
36c59dce
Commit
36c59dce
authored
Mar 31, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjusted search model code generated by Gii CRUD generator
parent
06fdb797
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
21 deletions
+2
-21
Generator.php
extensions/gii/generators/crud/Generator.php
+2
-2
search.php
extensions/gii/generators/crud/default/search.php
+0
-19
No files found.
extensions/gii/generators/crud/Generator.php
View file @
36c59dce
...
...
@@ -400,10 +400,10 @@ class Generator extends \yii\gii\Generator
case
Schema
::
TYPE_TIME
:
case
Schema
::
TYPE_DATETIME
:
case
Schema
::
TYPE_TIMESTAMP
:
$conditions
[]
=
"
\$
this->addFilter(
\$
query, '
{
$column
}
'
);"
;
$conditions
[]
=
"
\$
query->andFilter(['
{
$column
}
' =>
\$
this->
{
$column
}
]
);"
;
break
;
default
:
$conditions
[]
=
"
\$
this->addFilter(
\$
query, '
{
$column
}
', true
);"
;
$conditions
[]
=
"
\$
this->addFilter(
['like', '
{
$column
}
',
\$
this->
{
$column
}
]
);"
;
break
;
}
}
...
...
extensions/gii/generators/crud/default/search.php
View file @
36c59dce
...
...
@@ -70,23 +70,4 @@ class <?= $searchModelClass ?> extends Model
return $dataProvider;
}
protected function addCondition($query, $attribute, $partialMatch = false)
{
if (($pos = strrpos($attribute, '.')) !== false) {
$modelAttribute = substr($attribute, $pos + 1);
} else {
$modelAttribute = $attribute;
}
$value = $this->$modelAttribute;
if (trim($value) === '') {
return;
}
if ($partialMatch) {
$query->andWhere(['like', $attribute, $value]);
} else {
$query->andWhere([$attribute => $value]);
}
}
}
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