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
e562f8e4
Commit
e562f8e4
authored
Jan 13, 2015
by
Thiago Talma
Committed by
Alexander Makarov
Jan 24, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enh #6857: Added `yii\gii\Module::$ignoreTables` that allows you to ignore…
Enh #6857: Added `yii\gii\Module::$ignoreTables` that allows you to ignore tables during model generation using `*`
parent
06564db6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
CHANGELOG.md
extensions/gii/CHANGELOG.md
+1
-1
Module.php
extensions/gii/Module.php
+5
-0
Generator.php
extensions/gii/generators/model/Generator.php
+5
-0
No files found.
extensions/gii/CHANGELOG.md
View file @
e562f8e4
...
@@ -4,7 +4,7 @@ Yii Framework 2 gii extension Change Log
...
@@ -4,7 +4,7 @@ Yii Framework 2 gii extension Change Log
2.
0.3 under development
2.
0.3 under development
-----------------------
-----------------------
-
no changes in this release.
-
Enh #6857: Added
`yii\gii\Module::$ignoreTables`
that allows you to ignore tables during model generation using
`*`
(thiagotalma)
2.0.2 January 11, 2015
2.0.2 January 11, 2015
...
...
extensions/gii/Module.php
View file @
e562f8e4
...
@@ -77,6 +77,11 @@ class Module extends \yii\base\Module implements BootstrapInterface
...
@@ -77,6 +77,11 @@ class Module extends \yii\base\Module implements BootstrapInterface
* Defaults to 0777, meaning the directory can be read, written and executed by all users.
* Defaults to 0777, meaning the directory can be read, written and executed by all users.
*/
*/
public
$newDirMode
=
0777
;
public
$newDirMode
=
0777
;
/**
* @var array the list of table names to be ignored.
* @since 2.0.3
*/
public
$ignoreTables
=
[];
/**
/**
...
...
extensions/gii/generators/model/Generator.php
View file @
e562f8e4
...
@@ -525,6 +525,7 @@ class Generator extends \yii\gii\Generator
...
@@ -525,6 +525,7 @@ class Generator extends \yii\gii\Generator
}
}
$tableNames
=
[];
$tableNames
=
[];
if
(
strpos
(
$this
->
tableName
,
'*'
)
!==
false
)
{
if
(
strpos
(
$this
->
tableName
,
'*'
)
!==
false
)
{
$module
=
Yii
::
$app
->
controller
->
module
;
if
((
$pos
=
strrpos
(
$this
->
tableName
,
'.'
))
!==
false
)
{
if
((
$pos
=
strrpos
(
$this
->
tableName
,
'.'
))
!==
false
)
{
$schema
=
substr
(
$this
->
tableName
,
0
,
$pos
);
$schema
=
substr
(
$this
->
tableName
,
0
,
$pos
);
$pattern
=
'/^'
.
str_replace
(
'*'
,
'\w+'
,
substr
(
$this
->
tableName
,
$pos
+
1
))
.
'$/'
;
$pattern
=
'/^'
.
str_replace
(
'*'
,
'\w+'
,
substr
(
$this
->
tableName
,
$pos
+
1
))
.
'$/'
;
...
@@ -534,6 +535,10 @@ class Generator extends \yii\gii\Generator
...
@@ -534,6 +535,10 @@ class Generator extends \yii\gii\Generator
}
}
foreach
(
$db
->
schema
->
getTableNames
(
$schema
)
as
$table
)
{
foreach
(
$db
->
schema
->
getTableNames
(
$schema
)
as
$table
)
{
if
(
in_array
(
$table
,
$module
->
ignoreTables
))
{
continue
;
}
if
(
preg_match
(
$pattern
,
$table
))
{
if
(
preg_match
(
$pattern
,
$table
))
{
$tableNames
[]
=
$schema
===
''
?
$table
:
(
$schema
.
'.'
.
$table
);
$tableNames
[]
=
$schema
===
''
?
$table
:
(
$schema
.
'.'
.
$table
);
}
}
...
...
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