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
563377cc
Commit
563377cc
authored
Nov 08, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for missing sql when creating tables for model with templates that result in addition tables
parent
e33130b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
Export.php
lib/Doctrine/Export.php
+11
-10
No files found.
lib/Doctrine/Export.php
View file @
563377cc
...
@@ -1073,24 +1073,25 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1073,24 +1073,25 @@ class Doctrine_Export extends Doctrine_Connection_Module
}
}
$sql
=
$this
->
exportClassesSql
(
array
(
$class
));
$sql
=
$this
->
exportClassesSql
(
array
(
$class
));
// The create sql query is the first one, and everything else is the alters
// Build array of all the creates
$create
=
$sql
[
0
];
// We need these to happen first
foreach
(
$sql
as
$key
=>
$query
)
{
// Remove create from the main array
if
(
strstr
(
$query
,
'CREATE'
))
{
unset
(
$sql
[
0
]);
$connections
[
$connectionName
][
'creates'
][]
=
$query
;
// Unset the create from sql so we can have an array of everything else but creates
unset
(
$sql
[
$key
]);
}
}
// Store the creates and alters individually so we can merge them back together later
// We need the creates to happen first, then the alters
$connections
[
$connectionName
][
'creates'
][]
=
$create
;
$connections
[
$connectionName
][
'alters'
]
=
array_merge
(
$connections
[
$connectionName
][
'alters'
],
$sql
);
$connections
[
$connectionName
][
'alters'
]
=
array_merge
(
$connections
[
$connectionName
][
'alters'
],
$sql
);
}
}
// Loop over all the sql again to merge the creates and alters in to the same array, but so that the alters are at the bottom
// Loop over all the sql again to merge the creates and alters in to the same array, but so that the alters are at the bottom
$build
=
array
();
$build
=
array
();
foreach
(
$connections
as
$connectionName
=>
$sql
)
{
foreach
(
$connections
as
$connectionName
=>
$sql
)
{
$build
[
$connectionName
]
=
array_merge
(
$sql
[
'creates'
],
$sql
[
'alters'
]);
$build
[
$connectionName
]
=
array_merge
(
$sql
[
'creates'
],
$sql
[
'alters'
]);
}
}
foreach
(
$build
as
$connectionName
=>
$sql
)
{
foreach
(
$build
as
$connectionName
=>
$sql
)
{
$connection
=
Doctrine_Manager
::
getInstance
()
->
getConnection
(
$connectionName
);
$connection
=
Doctrine_Manager
::
getInstance
()
->
getConnection
(
$connectionName
);
...
...
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