Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Tomáš Trávníček
doctrine-dbal
Commits
406c57b5
Commit
406c57b5
authored
Jan 10, 2008
by
lsmith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- cosmetic fixes
parent
64e1f6e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
24 deletions
+24
-24
Export.php
lib/Doctrine/Export.php
+24
-24
No files found.
lib/Doctrine/Export.php
View file @
406c57b5
...
@@ -44,7 +44,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -44,7 +44,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
'date'
=>
'1970-01-01'
,
'date'
=>
'1970-01-01'
,
'clob'
=>
''
,
'clob'
=>
''
,
'blob'
=>
''
,
'blob'
=>
''
,
'string'
=>
''
'string'
=>
''
,
);
);
/**
/**
...
@@ -117,7 +117,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -117,7 +117,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
public
function
dropIndexSql
(
$table
,
$name
)
public
function
dropIndexSql
(
$table
,
$name
)
{
{
$name
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getIndexName
(
$name
));
$name
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
formatter
->
getIndexName
(
$name
));
return
'DROP INDEX '
.
$name
;
return
'DROP INDEX '
.
$name
;
}
}
...
@@ -133,7 +133,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -133,7 +133,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
{
{
$table
=
$this
->
conn
->
quoteIdentifier
(
$table
);
$table
=
$this
->
conn
->
quoteIdentifier
(
$table
);
$name
=
$this
->
conn
->
quoteIdentifier
(
$name
);
$name
=
$this
->
conn
->
quoteIdentifier
(
$name
);
return
$this
->
conn
->
exec
(
'ALTER TABLE '
.
$table
.
' DROP CONSTRAINT '
.
$name
);
return
$this
->
conn
->
exec
(
'ALTER TABLE '
.
$table
.
' DROP CONSTRAINT '
.
$name
);
}
}
...
@@ -358,7 +358,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -358,7 +358,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
public
function
createConstraint
(
$table
,
$name
,
$definition
)
public
function
createConstraint
(
$table
,
$name
,
$definition
)
{
{
$sql
=
$this
->
createConstraintSql
(
$table
,
$name
,
$definition
);
$sql
=
$this
->
createConstraintSql
(
$table
,
$name
,
$definition
);
return
$this
->
conn
->
exec
(
$sql
);
return
$this
->
conn
->
exec
(
$sql
);
}
}
...
@@ -474,7 +474,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -474,7 +474,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
$query
.=
' ('
.
implode
(
', '
,
$fields
)
.
')'
;
$query
.=
' ('
.
implode
(
', '
,
$fields
)
.
')'
;
return
$query
;
return
$query
;
}
}
/**
/**
* createForeignKeySql
* createForeignKeySql
*
*
...
@@ -501,7 +501,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -501,7 +501,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
public
function
createForeignKey
(
$table
,
array
$definition
)
public
function
createForeignKey
(
$table
,
array
$definition
)
{
{
$sql
=
$this
->
createForeignKeySql
(
$table
,
$definition
);
$sql
=
$this
->
createForeignKeySql
(
$table
,
$definition
);
return
$this
->
conn
->
execute
(
$sql
);
return
$this
->
conn
->
execute
(
$sql
);
}
}
...
@@ -597,7 +597,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -597,7 +597,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
public
function
alterTable
(
$name
,
array
$changes
,
$check
=
false
)
public
function
alterTable
(
$name
,
array
$changes
,
$check
=
false
)
{
{
$sql
=
$this
->
alterTableSql
(
$name
,
$changes
,
$check
);
$sql
=
$this
->
alterTableSql
(
$name
,
$changes
,
$check
);
if
(
is_string
(
$sql
)
&&
$sql
)
{
if
(
is_string
(
$sql
)
&&
$sql
)
{
$this
->
conn
->
execute
(
$sql
);
$this
->
conn
->
execute
(
$sql
);
}
}
...
@@ -1045,7 +1045,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1045,7 +1045,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
}
else
{
}
else
{
$models
=
Doctrine
::
getLoadedModels
();
$models
=
Doctrine
::
getLoadedModels
();
}
}
$this
->
exportClasses
(
$models
);
$this
->
exportClasses
(
$models
);
}
}
...
@@ -1065,13 +1065,13 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1065,13 +1065,13 @@ class Doctrine_Export extends Doctrine_Connection_Module
$record
=
new
$class
();
$record
=
new
$class
();
$connection
=
$record
->
getTable
()
->
getConnection
();
$connection
=
$record
->
getTable
()
->
getConnection
();
$connectionName
=
Doctrine_Manager
::
getInstance
()
->
getConnectionName
(
$connection
);
$connectionName
=
Doctrine_Manager
::
getInstance
()
->
getConnectionName
(
$connection
);
if
(
!
isset
(
$connections
[
$connectionName
]))
{
if
(
!
isset
(
$connections
[
$connectionName
]))
{
$connections
[
$connectionName
]
=
array
();
$connections
[
$connectionName
]
=
array
();
$connections
[
$connectionName
][
'creates'
]
=
array
();
$connections
[
$connectionName
][
'creates'
]
=
array
();
$connections
[
$connectionName
][
'alters'
]
=
array
();
$connections
[
$connectionName
][
'alters'
]
=
array
();
}
}
$sql
=
$this
->
exportClassesSql
(
array
(
$class
));
$sql
=
$this
->
exportClassesSql
(
array
(
$class
));
// Build array of all the creates
// Build array of all the creates
// We need these to happen first
// We need these to happen first
...
@@ -1082,7 +1082,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1082,7 +1082,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
unset
(
$sql
[
$key
]);
unset
(
$sql
[
$key
]);
}
}
}
}
$connections
[
$connectionName
][
'alters'
]
=
array_merge
(
$connections
[
$connectionName
][
'alters'
],
$sql
);
$connections
[
$connectionName
][
'alters'
]
=
array_merge
(
$connections
[
$connectionName
][
'alters'
],
$sql
);
}
}
...
@@ -1094,9 +1094,9 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1094,9 +1094,9 @@ class Doctrine_Export extends Doctrine_Connection_Module
foreach
(
$build
as
$connectionName
=>
$sql
)
{
foreach
(
$build
as
$connectionName
=>
$sql
)
{
$connection
=
Doctrine_Manager
::
getInstance
()
->
getConnection
(
$connectionName
);
$connection
=
Doctrine_Manager
::
getInstance
()
->
getConnection
(
$connectionName
);
$connection
->
beginTransaction
();
$connection
->
beginTransaction
();
foreach
(
$sql
as
$query
)
{
foreach
(
$sql
as
$query
)
{
try
{
try
{
$connection
->
exec
(
$query
);
$connection
->
exec
(
$query
);
...
@@ -1108,7 +1108,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1108,7 +1108,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
}
}
}
}
}
}
$connection
->
commit
();
$connection
->
commit
();
}
}
}
}
...
@@ -1125,9 +1125,9 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1125,9 +1125,9 @@ class Doctrine_Export extends Doctrine_Connection_Module
public
function
exportClassesSql
(
array
$classes
)
public
function
exportClassesSql
(
array
$classes
)
{
{
$models
=
Doctrine
::
filterInvalidModels
(
$classes
);
$models
=
Doctrine
::
filterInvalidModels
(
$classes
);
$sql
=
array
();
$sql
=
array
();
foreach
(
$models
as
$name
)
{
foreach
(
$models
as
$name
)
{
$record
=
new
$name
();
$record
=
new
$name
();
$table
=
$record
->
getTable
();
$table
=
$record
->
getTable
();
...
@@ -1138,7 +1138,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1138,7 +1138,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
$data
=
$table
->
getConnection
()
->
getTable
(
$parent
)
->
getExportableFormat
();
$data
=
$table
->
getConnection
()
->
getTable
(
$parent
)
->
getExportableFormat
();
$query
=
$this
->
conn
->
export
->
createTableSql
(
$data
[
'tableName'
],
$data
[
'columns'
],
$data
[
'options'
]);
$query
=
$this
->
conn
->
export
->
createTableSql
(
$data
[
'tableName'
],
$data
[
'columns'
],
$data
[
'options'
]);
$sql
=
array_merge
(
$sql
,
(
array
)
$query
);
$sql
=
array_merge
(
$sql
,
(
array
)
$query
);
}
}
...
@@ -1151,14 +1151,14 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1151,14 +1151,14 @@ class Doctrine_Export extends Doctrine_Connection_Module
}
else
{
}
else
{
$sql
[]
=
$query
;
$sql
[]
=
$query
;
}
}
if
(
$table
->
getAttribute
(
Doctrine
::
ATTR_EXPORT
)
&
Doctrine
::
EXPORT_PLUGINS
)
{
if
(
$table
->
getAttribute
(
Doctrine
::
ATTR_EXPORT
)
&
Doctrine
::
EXPORT_PLUGINS
)
{
$sql
=
array_merge
(
$sql
,
$this
->
exportGeneratorsSql
(
$table
));
$sql
=
array_merge
(
$sql
,
$this
->
exportGeneratorsSql
(
$table
));
}
}
}
}
$sql
=
array_unique
(
$sql
);
$sql
=
array_unique
(
$sql
);
rsort
(
$sql
);
rsort
(
$sql
);
return
$sql
;
return
$sql
;
...
@@ -1176,13 +1176,13 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1176,13 +1176,13 @@ class Doctrine_Export extends Doctrine_Connection_Module
foreach
(
$table
->
getGenerators
()
as
$name
=>
$generator
)
{
foreach
(
$table
->
getGenerators
()
as
$name
=>
$generator
)
{
if
(
$generator
===
null
)
{
if
(
$generator
===
null
)
{
continue
;
continue
;
}
}
$generators
[]
=
$generator
;
$generators
[]
=
$generator
;
$generatorTable
=
$generator
->
getTable
();
$generatorTable
=
$generator
->
getTable
();
if
(
$generatorTable
instanceof
Doctrine_Table
)
{
if
(
$generatorTable
instanceof
Doctrine_Table
)
{
$generators
=
array_merge
(
$generators
,
$this
->
getAllGenerators
(
$generatorTable
));
$generators
=
array_merge
(
$generators
,
$this
->
getAllGenerators
(
$generatorTable
));
}
}
...
@@ -1203,7 +1203,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1203,7 +1203,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
$sql
=
array
();
$sql
=
array
();
foreach
(
$this
->
getAllGenerators
(
$table
)
as
$name
=>
$generator
)
{
foreach
(
$this
->
getAllGenerators
(
$table
)
as
$name
=>
$generator
)
{
$table
=
$generator
->
getTable
();
$table
=
$generator
->
getTable
();
// Make sure plugin has a valid table
// Make sure plugin has a valid table
if
(
$table
instanceof
Doctrine_Table
)
{
if
(
$table
instanceof
Doctrine_Table
)
{
$data
=
$table
->
getExportableFormat
();
$data
=
$table
->
getExportableFormat
();
...
@@ -1237,7 +1237,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1237,7 +1237,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
}
else
{
}
else
{
$models
=
Doctrine
::
getLoadedModels
();
$models
=
Doctrine
::
getLoadedModels
();
}
}
return
$this
->
exportClassesSql
(
$models
);
return
$this
->
exportClassesSql
(
$models
);
}
}
...
...
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