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
50ab1867
Commit
50ab1867
authored
Oct 16, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for sql exporting so it will get all loaded models if no directory is specified.
parent
f2a7390c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
7 deletions
+17
-7
Export.php
lib/Doctrine/Data/Export.php
+8
-2
Export.php
lib/Doctrine/Export.php
+9
-5
No files found.
lib/Doctrine/Data/Export.php
View file @
50ab1867
...
@@ -101,19 +101,25 @@ class Doctrine_Data_Export extends Doctrine_Data
...
@@ -101,19 +101,25 @@ class Doctrine_Data_Export extends Doctrine_Data
if
(
is_array
(
$directory
))
{
if
(
is_array
(
$directory
))
{
throw
new
Doctrine_Data_Exception
(
'You must specify a single path to a folder in order to export individual files.'
);
throw
new
Doctrine_Data_Exception
(
'You must specify a single path to a folder in order to export individual files.'
);
}
else
if
(
!
is_dir
(
$directory
)
&&
is_file
(
$directory
))
{
$directory
=
dirname
(
$directory
);
}
}
foreach
(
$data
as
$className
=>
$classData
)
{
foreach
(
$data
as
$className
=>
$classData
)
{
if
(
!
empty
(
$classData
))
{
Doctrine_Parser
::
dump
(
array
(
$className
=>
$classData
),
$format
,
$directory
.
DIRECTORY_SEPARATOR
.
$className
.
'.'
.
$format
);
Doctrine_Parser
::
dump
(
array
(
$className
=>
$classData
),
$format
,
$directory
.
DIRECTORY_SEPARATOR
.
$className
.
'.'
.
$format
);
}
}
}
}
else
{
}
else
{
if
(
is_dir
(
$directory
))
{
if
(
is_dir
(
$directory
))
{
throw
new
Doctrine_Data_Exception
(
'You must specify the path to a '
.
$format
.
' file to export. You specified a directory.'
);
throw
new
Doctrine_Data_Exception
(
'You must specify the path to a '
.
$format
.
' file to export. You specified a directory.'
);
}
}
if
(
!
empty
(
$data
))
{
return
Doctrine_Parser
::
dump
(
$data
,
$format
,
$directory
);
return
Doctrine_Parser
::
dump
(
$data
,
$format
,
$directory
);
}
}
}
}
}
/**
/**
* prepareData
* prepareData
*
*
...
...
lib/Doctrine/Export.php
View file @
50ab1867
...
@@ -978,9 +978,9 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -978,9 +978,9 @@ class Doctrine_Export extends Doctrine_Connection_Module
public
function
exportSchema
(
$directory
=
null
)
public
function
exportSchema
(
$directory
=
null
)
{
{
if
(
$directory
!==
null
)
{
if
(
$directory
!==
null
)
{
$models
=
Doctrine
::
loadModels
(
$directory
);
$models
=
Doctrine
_Facade
::
loadModels
(
$directory
);
}
else
{
}
else
{
$models
=
Doctrine
::
getLoadedModels
();
$models
=
Doctrine
_Facade
::
getLoadedModels
();
}
}
$this
->
exportClasses
(
$models
);
$this
->
exportClasses
(
$models
);
...
@@ -1058,7 +1058,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1058,7 +1058,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
*/
*/
public
function
exportClassesSql
(
array
$classes
)
public
function
exportClassesSql
(
array
$classes
)
{
{
$models
=
Doctrine
::
getLoadedModels
(
$classes
);
$models
=
Doctrine
_Facade
::
getLoadedModels
(
$classes
);
$sql
=
array
();
$sql
=
array
();
...
@@ -1136,7 +1136,11 @@ class Doctrine_Export extends Doctrine_Connection_Module
...
@@ -1136,7 +1136,11 @@ class Doctrine_Export extends Doctrine_Connection_Module
*/
*/
public
function
exportSql
(
$directory
=
null
)
public
function
exportSql
(
$directory
=
null
)
{
{
$models
=
Doctrine
::
loadModels
(
$directory
);
if
(
$directory
!==
null
)
{
$models
=
Doctrine_Facade
::
loadModels
(
$directory
);
}
else
{
$models
=
Doctrine_Facade
::
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