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
37cec1d6
Commit
37cec1d6
authored
Oct 16, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
-
parent
50ab1867
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
25 deletions
+7
-25
Schema.php
lib/Doctrine/Export/Schema.php
+2
-24
Facade.php
lib/Doctrine/Facade.php
+5
-1
No files found.
lib/Doctrine/Export/Schema.php
View file @
37cec1d6
...
@@ -48,13 +48,13 @@ class Doctrine_Export_Schema
...
@@ -48,13 +48,13 @@ class Doctrine_Export_Schema
*/
*/
public
function
buildSchema
(
$directory
=
null
,
$models
=
array
())
public
function
buildSchema
(
$directory
=
null
,
$models
=
array
())
{
{
$array
=
array
();
if
(
$directory
)
{
if
(
$directory
)
{
$loadedModels
=
Doctrine
::
loadModels
(
$directory
);
$loadedModels
=
Doctrine
::
loadModels
(
$directory
);
}
else
{
}
else
{
$loadedModels
=
Doctrine
::
getLoadedModels
();
$loadedModels
=
Doctrine
::
getLoadedModels
();
}
}
$array
=
array
();
$parent
=
new
ReflectionClass
(
'Doctrine_Record'
);
$parent
=
new
ReflectionClass
(
'Doctrine_Record'
);
...
@@ -67,28 +67,6 @@ class Doctrine_Export_Schema
...
@@ -67,28 +67,6 @@ class Doctrine_Export_Schema
if
(
!
empty
(
$models
)
&&
!
in_array
(
$name
,
$models
))
{
if
(
!
empty
(
$models
)
&&
!
in_array
(
$name
,
$models
))
{
continue
;
continue
;
}
}
$class
=
new
ReflectionClass
(
$name
);
// 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)
// we have to recursively iterate through the class parents just to be sure that the classes using for example
// column aggregation inheritance are properly exported to database
while
(
$class
->
isAbstract
()
||
!
$class
->
isSubclassOf
(
$parent
)
||
!
$class
->
hasMethod
(
'setTableDefinition'
)
||
(
$class
->
hasMethod
(
'setTableDefinition'
)
&&
$class
->
getMethod
(
'setTableDefinition'
)
->
getDeclaringClass
()
->
getName
()
!==
$class
->
getName
()))
{
$class
=
$class
->
getParentClass
();
if
(
$class
===
false
)
{
break
;
}
}
if
(
$class
===
false
)
{
continue
;
}
$record
=
new
$name
();
$record
=
new
$name
();
$recordTable
=
$record
->
getTable
();
$recordTable
=
$record
->
getTable
();
...
...
lib/Doctrine/Facade.php
View file @
37cec1d6
...
@@ -173,7 +173,11 @@ class Doctrine_Facade
...
@@ -173,7 +173,11 @@ class Doctrine_Facade
$export
=
new
Doctrine_Export_Schema
();
$export
=
new
Doctrine_Export_Schema
();
return
$export
->
exportSchema
(
$yamlPath
,
'yml'
,
$directory
);
$result
=
$export
->
exportSchema
(
$yamlPath
,
'yml'
,
$directory
);
exec
(
'rm -rf '
.
$directory
);
return
$result
;
}
}
/**
/**
* generateModelsFromYaml
* generateModelsFromYaml
...
...
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