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
64ead091
Commit
64ead091
authored
Jan 23, 2008
by
jwage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formatting fixes.
parent
ee3bf044
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
75 deletions
+73
-75
Migration.php
lib/Doctrine/Migration.php
+73
-75
No files found.
lib/Doctrine/Migration.php
View file @
64ead091
...
@@ -66,9 +66,9 @@ class Doctrine_Migration
...
@@ -66,9 +66,9 @@ class Doctrine_Migration
if
(
$directory
!=
null
)
{
if
(
$directory
!=
null
)
{
$this
->
_migrationClassesDirectory
=
$directory
;
$this
->
_migrationClassesDirectory
=
$directory
;
$this
->
loadMigrationClasses
();
$this
->
_
loadMigrationClasses
();
$this
->
createMigrationTable
();
$this
->
_
createMigrationTable
();
}
}
}
}
...
@@ -101,7 +101,7 @@ class Doctrine_Migration
...
@@ -101,7 +101,7 @@ class Doctrine_Migration
*
*
* @return void
* @return void
*/
*/
protected
function
createMigrationTable
()
protected
function
_
createMigrationTable
()
{
{
$conn
=
Doctrine_Manager
::
connection
();
$conn
=
Doctrine_Manager
::
connection
();
...
@@ -114,7 +114,6 @@ class Doctrine_Migration
...
@@ -114,7 +114,6 @@ class Doctrine_Migration
}
}
}
}
/**
/**
* loadMigrationClassesFromDirectory
* loadMigrationClassesFromDirectory
*
*
...
@@ -152,7 +151,7 @@ class Doctrine_Migration
...
@@ -152,7 +151,7 @@ class Doctrine_Migration
*
*
* @return void
* @return void
*/
*/
protected
function
loadMigrationClasses
()
protected
function
_
loadMigrationClasses
()
{
{
if
(
$this
->
_migrationClasses
)
{
if
(
$this
->
_migrationClasses
)
{
return
$this
->
_migrationClasses
;
return
$this
->
_migrationClasses
;
...
@@ -161,17 +160,15 @@ class Doctrine_Migration
...
@@ -161,17 +160,15 @@ class Doctrine_Migration
$classes
=
get_declared_classes
();
$classes
=
get_declared_classes
();
if
(
$this
->
_migrationClassesDirectory
!==
null
)
{
if
(
$this
->
_migrationClassesDirectory
!==
null
)
{
$this
->
loadMigrationClassesFromDirectory
(
$classes
);
$this
->
_
loadMigrationClassesFromDirectory
(
$classes
);
}
}
$parent
=
new
ReflectionClass
(
'Doctrine_Migration'
);
$parent
=
new
ReflectionClass
(
'Doctrine_Migration'
);
foreach
(
$this
->
_loadedMigrations
as
$name
=>
$fileName
)
{
foreach
(
$this
->
_loadedMigrations
as
$name
=>
$fileName
)
{
$class
=
new
ReflectionClass
(
$name
);
$class
=
new
ReflectionClass
(
$name
);
while
(
$class
->
isSubclassOf
(
$parent
))
{
while
(
$class
->
isSubclassOf
(
$parent
))
{
$class
=
$class
->
getParentClass
();
$class
=
$class
->
getParentClass
();
if
(
$class
===
false
)
{
if
(
$class
===
false
)
{
break
;
break
;
...
@@ -209,7 +206,7 @@ class Doctrine_Migration
...
@@ -209,7 +206,7 @@ class Doctrine_Migration
* @param string $number
* @param string $number
* @return void
* @return void
*/
*/
protected
function
setCurrentVersion
(
$number
)
protected
function
_
setCurrentVersion
(
$number
)
{
{
$conn
=
Doctrine_Manager
::
connection
();
$conn
=
Doctrine_Manager
::
connection
();
...
@@ -261,7 +258,7 @@ class Doctrine_Migration
...
@@ -261,7 +258,7 @@ class Doctrine_Migration
*/
*/
public
function
getLatestVersion
()
public
function
getLatestVersion
()
{
{
$this
->
loadMigrationClasses
();
$this
->
_
loadMigrationClasses
();
$versions
=
array
();
$versions
=
array
();
foreach
(
array_keys
(
$this
->
_migrationClasses
)
as
$classMigrationNum
)
{
foreach
(
array_keys
(
$this
->
_migrationClasses
)
as
$classMigrationNum
)
{
...
@@ -291,7 +288,7 @@ class Doctrine_Migration
...
@@ -291,7 +288,7 @@ class Doctrine_Migration
* @param string $num
* @param string $num
* @return void
* @return void
*/
*/
protected
function
getMigrationClass
(
$num
)
protected
function
_
getMigrationClass
(
$num
)
{
{
foreach
(
$this
->
_migrationClasses
as
$classMigrationNum
=>
$info
)
{
foreach
(
$this
->
_migrationClasses
as
$classMigrationNum
=>
$info
)
{
$className
=
$info
[
'className'
];
$className
=
$info
[
'className'
];
...
@@ -313,11 +310,11 @@ class Doctrine_Migration
...
@@ -313,11 +310,11 @@ class Doctrine_Migration
* @param string $num
* @param string $num
* @return void
* @return void
*/
*/
protected
function
doMigrateStep
(
$direction
,
$num
)
protected
function
_
doMigrateStep
(
$direction
,
$num
)
{
{
$migrate
=
$this
->
getMigrationClass
(
$num
);
$migrate
=
$this
->
_
getMigrationClass
(
$num
);
$migrate
->
doMigrate
(
$direction
);
$migrate
->
_
doMigrate
(
$direction
);
}
}
/**
/**
...
@@ -328,11 +325,12 @@ class Doctrine_Migration
...
@@ -328,11 +325,12 @@ class Doctrine_Migration
* @param string $direction
* @param string $direction
* @return void
* @return void
*/
*/
protected
function
doMigrate
(
$direction
)
protected
function
_
doMigrate
(
$direction
)
{
{
if
(
!
method_exists
(
$this
,
$direction
))
{
if
(
!
method_exists
(
$this
,
$direction
))
{
return
;
return
;
}
}
$this
->
$direction
();
$this
->
$direction
();
foreach
(
$this
->
_changes
as
$type
=>
$changes
)
{
foreach
(
$this
->
_changes
as
$type
=>
$changes
)
{
...
@@ -372,15 +370,15 @@ class Doctrine_Migration
...
@@ -372,15 +370,15 @@ class Doctrine_Migration
if
(
$direction
===
'up'
)
{
if
(
$direction
===
'up'
)
{
for
(
$i
=
$from
+
1
;
$i
<=
$to
;
$i
++
)
{
for
(
$i
=
$from
+
1
;
$i
<=
$to
;
$i
++
)
{
$this
->
doMigrateStep
(
$direction
,
$i
);
$this
->
_
doMigrateStep
(
$direction
,
$i
);
}
}
}
else
{
}
else
{
for
(
$i
=
$from
;
$i
>
$to
;
$i
--
)
{
for
(
$i
=
$from
;
$i
>
$to
;
$i
--
)
{
$this
->
doMigrateStep
(
$direction
,
$i
);
$this
->
_
doMigrateStep
(
$direction
,
$i
);
}
}
}
}
$this
->
setCurrentVersion
(
$to
);
$this
->
_
setCurrentVersion
(
$to
);
return
$to
;
return
$to
;
}
}
...
@@ -392,7 +390,7 @@ class Doctrine_Migration
...
@@ -392,7 +390,7 @@ class Doctrine_Migration
* @param string $array
* @param string $array
* @return void
* @return void
*/
*/
protected
function
addChange
(
$type
,
array
$change
=
array
())
protected
function
_
addChange
(
$type
,
array
$change
=
array
())
{
{
$this
->
_changes
[
$type
][]
=
$change
;
$this
->
_changes
[
$type
][]
=
$change
;
}
}
...
@@ -409,7 +407,7 @@ class Doctrine_Migration
...
@@ -409,7 +407,7 @@ class Doctrine_Migration
{
{
$options
=
get_defined_vars
();
$options
=
get_defined_vars
();
$this
->
addChange
(
'created_tables'
,
$options
);
$this
->
_
addChange
(
'created_tables'
,
$options
);
}
}
/**
/**
...
@@ -422,7 +420,7 @@ class Doctrine_Migration
...
@@ -422,7 +420,7 @@ class Doctrine_Migration
{
{
$options
=
get_defined_vars
();
$options
=
get_defined_vars
();
$this
->
addChange
(
'dropped_tables'
,
$options
);
$this
->
_
addChange
(
'dropped_tables'
,
$options
);
}
}
/**
/**
...
@@ -436,7 +434,7 @@ class Doctrine_Migration
...
@@ -436,7 +434,7 @@ class Doctrine_Migration
{
{
$options
=
get_defined_vars
();
$options
=
get_defined_vars
();
$this
->
addChange
(
'renamed_tables'
,
$options
);
$this
->
_
addChange
(
'renamed_tables'
,
$options
);
}
}
/**
/**
...
@@ -450,7 +448,7 @@ class Doctrine_Migration
...
@@ -450,7 +448,7 @@ class Doctrine_Migration
{
{
$options
=
get_defined_vars
();
$options
=
get_defined_vars
();
$this
->
addChange
(
'created_constraints'
,
$options
);
$this
->
_
addChange
(
'created_constraints'
,
$options
);
}
}
/**
/**
...
@@ -464,7 +462,7 @@ class Doctrine_Migration
...
@@ -464,7 +462,7 @@ class Doctrine_Migration
{
{
$options
=
get_defined_vars
();
$options
=
get_defined_vars
();
$this
->
addChange
(
'dropped_constraints'
,
$options
);
$this
->
_
addChange
(
'dropped_constraints'
,
$options
);
}
}
/**
/**
...
@@ -478,7 +476,7 @@ class Doctrine_Migration
...
@@ -478,7 +476,7 @@ class Doctrine_Migration
{
{
$options
=
get_defined_vars
();
$options
=
get_defined_vars
();
$this
->
addChange
(
'created_fks'
,
$options
);
$this
->
_
addChange
(
'created_fks'
,
$options
);
}
}
/**
/**
...
@@ -492,7 +490,7 @@ class Doctrine_Migration
...
@@ -492,7 +490,7 @@ class Doctrine_Migration
{
{
$options
=
get_defined_vars
();
$options
=
get_defined_vars
();
$this
->
addChange
(
'dropped_fks'
,
$options
);
$this
->
_
addChange
(
'dropped_fks'
,
$options
);
}
}
/**
/**
...
@@ -508,7 +506,7 @@ class Doctrine_Migration
...
@@ -508,7 +506,7 @@ class Doctrine_Migration
{
{
$options
=
get_defined_vars
();
$options
=
get_defined_vars
();
$this
->
addChange
(
'added_columns'
,
$options
);
$this
->
_
addChange
(
'added_columns'
,
$options
);
}
}
/**
/**
...
@@ -523,7 +521,7 @@ class Doctrine_Migration
...
@@ -523,7 +521,7 @@ class Doctrine_Migration
{
{
$options
=
get_defined_vars
();
$options
=
get_defined_vars
();
$this
->
addChange
(
'renamed_columns'
,
$options
);
$this
->
_
addChange
(
'renamed_columns'
,
$options
);
}
}
/**
/**
...
@@ -539,7 +537,7 @@ class Doctrine_Migration
...
@@ -539,7 +537,7 @@ class Doctrine_Migration
{
{
$options
=
get_defined_vars
();
$options
=
get_defined_vars
();
$this
->
addChange
(
'changed_columns'
,
$options
);
$this
->
_
addChange
(
'changed_columns'
,
$options
);
}
}
/**
/**
...
@@ -553,7 +551,7 @@ class Doctrine_Migration
...
@@ -553,7 +551,7 @@ class Doctrine_Migration
{
{
$options
=
get_defined_vars
();
$options
=
get_defined_vars
();
$this
->
addChange
(
'removed_columns'
,
$options
);
$this
->
_
addChange
(
'removed_columns'
,
$options
);
}
}
/**
/**
...
@@ -568,7 +566,7 @@ class Doctrine_Migration
...
@@ -568,7 +566,7 @@ class Doctrine_Migration
{
{
$options
=
get_defined_vars
();
$options
=
get_defined_vars
();
$this
->
addChange
(
'added_indexes'
,
$options
);
$this
->
_
addChange
(
'added_indexes'
,
$options
);
}
}
/**
/**
...
@@ -582,6 +580,6 @@ class Doctrine_Migration
...
@@ -582,6 +580,6 @@ class Doctrine_Migration
{
{
$options
=
get_defined_vars
();
$options
=
get_defined_vars
();
$this
->
addChange
(
'removed_indexes'
,
$options
);
$this
->
_
addChange
(
'removed_indexes'
,
$options
);
}
}
}
}
\ No newline at end of file
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