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
2bd36677
Commit
2bd36677
authored
Nov 25, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A few fixes to Migrations and formatting/code fixes.
parent
3829b0f2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
26 deletions
+8
-26
Doctrine.php
lib/Doctrine.php
+1
-1
Migration.php
lib/Doctrine/Migration.php
+1
-1
Builder.php
lib/Doctrine/Migration/Builder.php
+6
-24
No files found.
lib/Doctrine.php
View file @
2bd36677
...
...
@@ -1114,7 +1114,7 @@ final class Doctrine
*/
public
static
function
makeDirectories
(
$path
,
$mode
=
0777
)
{
if
(
!
$path
)
{
if
(
!
$path
)
{
return
false
;
}
...
...
lib/Doctrine/Migration.php
View file @
2bd36677
lib/Doctrine/Migration/Builder.php
View file @
2bd36677
...
...
@@ -82,9 +82,7 @@ class Doctrine_Migration_Builder
*/
public
function
setMigrationsPath
(
$path
)
{
if
(
!
file_exists
(
$path
))
{
mkdir
(
$path
,
0777
);
}
Doctrine
::
makeDirectories
(
$path
);
$this
->
migrationsPath
=
$path
;
}
...
...
@@ -138,7 +136,7 @@ END;
*/
public
function
generateMigrationsFromDb
()
{
$directory
=
'/tmp/
tmp_doctrine_models'
;
$directory
=
sys_get_temp_dir
()
.
DIRECTORY_SEPARATOR
.
'
tmp_doctrine_models'
;
Doctrine
::
generateModelsFromDb
(
$directory
);
...
...
@@ -173,7 +171,7 @@ END;
$up
=
$this
->
buildCreateTable
(
$export
);
$down
=
$this
->
buildDropTable
(
$export
);
$className
=
'Add'
.
Doctrine
::
classify
(
$export
[
'tableName'
]);
$className
=
'Add'
.
Doctrine
::
classify
(
$export
[
'tableName'
]);
$this
->
generateMigrationClass
(
$className
,
array
(),
$up
,
$down
);
}
...
...
@@ -207,7 +205,7 @@ END;
*/
public
function
buildCreateForeignKey
(
$tableName
,
$definition
)
{
return
"
\t\t\$
this->createForeignKey('"
.
$tableName
.
"', "
.
$this
->
dataToPhpCode
(
$definition
)
.
");"
;
return
"
\t\t\$
this->createForeignKey('"
.
$tableName
.
"', "
.
var_export
(
$definition
,
true
)
.
");"
;
}
/**
...
...
@@ -232,9 +230,9 @@ END;
{
$code
=
"
\t\t\$
this->createTable('"
.
$tableData
[
'tableName'
]
.
"', "
;
$code
.=
$this
->
dataToPhpCode
(
$tableData
[
'columns'
]
)
.
", "
;
$code
.=
var_export
(
$tableData
[
'columns'
],
true
)
.
", "
;
$code
.=
$this
->
dataToPhpCode
(
array
(
'indexes'
=>
$tableData
[
'options'
][
'indexes'
],
'primary'
=>
$tableData
[
'options'
][
'primary'
])
);
$code
.=
var_export
(
array
(
'indexes'
=>
$tableData
[
'options'
][
'indexes'
],
'primary'
=>
$tableData
[
'options'
][
'primary'
]),
true
);
$code
.=
");"
;
...
...
@@ -252,22 +250,6 @@ END;
return
"
\t\t\$
this->dropTable('"
.
$tableData
[
'tableName'
]
.
"');"
;
}
/**
* dataToPhpCode
*
* @param string $data
* @return string
*/
public
function
dataToPhpCode
(
$data
)
{
ob_start
();
var_export
(
$data
);
$results
=
ob_get_contents
();
ob_end_clean
();
return
$results
;
}
/**
* generateMigrationClass
*
...
...
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