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
07b5727c
Commit
07b5727c
authored
Sep 01, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
severe export bug fix: classes using column aggregation inheritance not properly exported
parent
5d1d506a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
11 deletions
+22
-11
Export.php
lib/Doctrine/Export.php
+22
-11
No files found.
lib/Doctrine/Export.php
View file @
07b5727c
...
...
@@ -1042,20 +1042,31 @@ class Doctrine_Export extends Doctrine_Connection_Module
// check if class is an instance of Doctrine_Record and not abstract
// class must have method setTableDefinition (to avoid non-Record subclasses like symfony's sfDoctrineRecord)
if
(
$class
->
isSubclassOf
(
$parent
)
&&
!
$class
->
isAbstract
()
&&
$class
->
hasMethod
(
'setTableDefinition'
)
&&
$class
->
getMethod
(
'setTableDefinition'
)
->
getDeclaringClass
()
->
getName
()
==
$class
->
getName
())
{
$record
=
new
$name
();
$table
=
$record
->
getTable
();
$data
=
$table
->
getExportableFormat
();
$query
=
$this
->
conn
->
export
->
createTableSql
(
$data
[
'tableName'
],
$data
[
'columns'
],
$data
[
'options'
]);
// we have to recursively iterate through the class parents just to be sure that the classes using for example
// column aggregation inheritance are properly exporterd to database
while
(
$class
->
isAbstract
()
&&
!
$class
->
isSubclassOf
(
$parent
)
&&
!
$class
->
hasMethod
(
'setTableDefinition'
)
&&
$class
->
getMethod
(
'setTableDefinition'
)
->
getDeclaringClass
()
->
getName
()
!==
$class
->
getName
())
{
if
(
is_array
(
$query
))
{
$sql
=
array_merge
(
$sql
,
$query
);
}
else
{
$sql
[]
=
$query
;
$class
=
$class
->
getParent
();
if
(
$class
===
null
)
{
break
;
}
}
$record
=
new
$name
();
$table
=
$record
->
getTable
();
$data
=
$table
->
getExportableFormat
();
$query
=
$this
->
conn
->
export
->
createTableSql
(
$data
[
'tableName'
],
$data
[
'columns'
],
$data
[
'options'
]);
if
(
is_array
(
$query
))
{
$sql
=
array_merge
(
$sql
,
$query
);
}
else
{
$sql
[]
=
$query
;
}
}
$sql
=
array_unique
(
$sql
);
rsort
(
$sql
);
...
...
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