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
db10d4a0
Commit
db10d4a0
authored
Oct 26, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formatting/standards changes.
parent
4428b517
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
332 additions
and
311 deletions
+332
-311
Doctrine.php
lib/Doctrine.php
+3
-2
Cli.php
lib/Doctrine/Cli.php
+45
-31
AnsiColorFormatter.php
lib/Doctrine/Cli/AnsiColorFormatter.php
+97
-104
Formatter.php
lib/Doctrine/Cli/Formatter.php
+61
-58
Data.php
lib/Doctrine/Data.php
+20
-20
Import.php
lib/Doctrine/Data/Import.php
+1
-1
Builder.php
lib/Doctrine/Import/Builder.php
+39
-39
Schema.php
lib/Doctrine/Import/Schema.php
+29
-18
Migration.php
lib/Doctrine/Migration.php
+37
-38
GenerateMigrationsModels.php
lib/Doctrine/Task/GenerateMigrationsModels.php
+0
-0
No files found.
lib/Doctrine.php
View file @
db10d4a0
...
...
@@ -686,12 +686,13 @@ final class Doctrine
*
* @param string $yamlPath Path to your yaml schema files
* @param string $directory Directory to generate your models in
* @param array $options Array of options to pass to the schema importer
* @return void
*/
public
static
function
generateModelsFromYaml
(
$yamlPath
,
$directory
)
public
static
function
generateModelsFromYaml
(
$yamlPath
,
$directory
,
$options
=
array
()
)
{
$import
=
new
Doctrine_Import_Schema
();
$import
->
generateBaseClasses
(
true
);
$import
->
setOption
(
'generateBaseClasses'
,
true
);
return
$import
->
importSchema
(
$yamlPath
,
'yml'
,
$directory
);
}
...
...
lib/Doctrine/Cli.php
View file @
db10d4a0
...
...
@@ -32,12 +32,12 @@
*/
class
Doctrine_Cli
{
protected
$tasks
=
array
(),
$taskInstance
=
null
,
$formatter
=
null
,
$scriptName
=
null
,
$message
=
null
,
$config
=
array
();
protected
$
_
tasks
=
array
(),
$
_
taskInstance
=
null
,
$
_
formatter
=
null
,
$
_
scriptName
=
null
,
$
_
message
=
null
,
$
_
config
=
array
();
/**
* __construct
...
...
@@ -47,8 +47,8 @@ class Doctrine_Cli
*/
public
function
__construct
(
$config
=
array
())
{
$this
->
config
=
$config
;
$this
->
formatter
=
new
Doctrine_Cli_AnsiColorFormatter
();
$this
->
_
config
=
$config
;
$this
->
_
formatter
=
new
Doctrine_Cli_AnsiColorFormatter
();
$this
->
loadTasks
();
}
...
...
@@ -61,7 +61,7 @@ class Doctrine_Cli
*/
public
function
notify
(
$notification
=
null
,
$style
=
'HEADER'
)
{
echo
$this
->
formatter
->
format
(
$this
->
taskInstance
->
getTaskName
(),
'INFO'
)
.
' - '
.
$this
->
formatter
->
format
(
$notification
,
$style
)
.
"
\n
"
;
echo
$this
->
_formatter
->
format
(
$this
->
_taskInstance
->
getTaskName
(),
'INFO'
)
.
' - '
.
$this
->
_
formatter
->
format
(
$notification
,
$style
)
.
"
\n
"
;
}
/**
...
...
@@ -72,7 +72,7 @@ class Doctrine_Cli
*/
public
function
notifyException
(
$exception
)
{
echo
$this
->
formatter
->
format
(
$exception
->
getMessage
(),
'ERROR'
)
.
"
\n
"
;
echo
$this
->
_
formatter
->
format
(
$exception
->
getMessage
(),
'ERROR'
)
.
"
\n
"
;
}
/**
...
...
@@ -90,7 +90,15 @@ class Doctrine_Cli
$this
->
notifyException
(
$exception
);
}
}
/**
* _getTaskClassFromArgs
*
* Get the task class from an array of cli arguments
*
* @param string $args
* @return void
*/
protected
function
_getTaskClassFromArgs
(
$args
)
{
$taskName
=
str_replace
(
'-'
,
'_'
,
$args
[
1
]);
...
...
@@ -98,10 +106,16 @@ class Doctrine_Cli
return
$taskClass
;
}
/**
* _run
*
* @param string $args
* @return void
*/
protected
function
_run
(
$args
)
{
$this
->
scriptName
=
$args
[
0
];
$this
->
_
scriptName
=
$args
[
0
];
$arg1
=
isset
(
$args
[
1
])
?
$args
[
1
]
:
null
;
...
...
@@ -124,17 +138,17 @@ class Doctrine_Cli
unset
(
$args
[
0
]);
unset
(
$args
[
1
]);
$this
->
taskInstance
=
new
$taskClass
(
$this
);
$this
->
_
taskInstance
=
new
$taskClass
(
$this
);
$args
=
$this
->
prepareArgs
(
$args
);
$this
->
taskInstance
->
setArguments
(
$args
);
$this
->
_
taskInstance
->
setArguments
(
$args
);
try
{
if
(
$this
->
taskInstance
->
validate
())
{
$this
->
taskInstance
->
execute
();
if
(
$this
->
_
taskInstance
->
validate
())
{
$this
->
_
taskInstance
->
execute
();
}
else
{
echo
$this
->
formatter
->
format
(
'Requires arguments missing!!'
,
'ERROR'
)
.
"
\n\n
"
;
echo
$this
->
_
formatter
->
format
(
'Requires arguments missing!!'
,
'ERROR'
)
.
"
\n\n
"
;
echo
$this
->
printTasks
(
$arg1
,
true
);
}
}
catch
(
Exception
$e
)
{
...
...
@@ -150,7 +164,7 @@ class Doctrine_Cli
*/
protected
function
prepareArgs
(
$args
)
{
$taskInstance
=
$this
->
taskInstance
;
$taskInstance
=
$this
->
_
taskInstance
;
$args
=
array_values
(
$args
);
...
...
@@ -168,8 +182,8 @@ class Doctrine_Cli
}
// If we have a config array then lets try and fill some of the arguments with the config values
if
(
is_array
(
$this
->
config
)
&&
!
empty
(
$this
->
config
))
{
foreach
(
$this
->
config
as
$key
=>
$value
)
{
if
(
is_array
(
$this
->
_config
)
&&
!
empty
(
$this
->
_
config
))
{
foreach
(
$this
->
_
config
as
$key
=>
$value
)
{
if
(
array_key_exists
(
$key
,
$prepared
))
{
$prepared
[
$key
]
=
$value
;
}
...
...
@@ -202,7 +216,7 @@ class Doctrine_Cli
$tasks
=
$this
->
getLoadedTasks
();
echo
$this
->
formatter
->
format
(
"Doctrine Command Line Interface"
,
'HEADER'
)
.
"
\n\n
"
;
echo
$this
->
_
formatter
->
format
(
"Doctrine Command Line Interface"
,
'HEADER'
)
.
"
\n\n
"
;
foreach
(
$tasks
as
$taskName
)
{
...
...
@@ -214,9 +228,9 @@ class Doctrine_Cli
$taskInstance
=
new
$className
();
$taskInstance
->
taskName
=
str_replace
(
'_'
,
'-'
,
Doctrine
::
tableize
(
$taskName
));
$syntax
=
$this
->
scriptName
.
' '
.
$taskInstance
->
getTaskName
();
$syntax
=
$this
->
_
scriptName
.
' '
.
$taskInstance
->
getTaskName
();
echo
$this
->
formatter
->
format
(
$syntax
,
'INFO'
);
echo
$this
->
_
formatter
->
format
(
$syntax
,
'INFO'
);
if
(
$full
)
{
echo
" - "
.
$taskInstance
->
getDescription
()
.
"
\n
"
;
...
...
@@ -227,10 +241,10 @@ class Doctrine_Cli
if
(
!
empty
(
$requiredArguments
))
{
foreach
(
$requiredArguments
as
$name
=>
$description
)
{
$args
.=
$this
->
formatter
->
format
(
$name
,
"ERROR"
);
$args
.=
$this
->
_
formatter
->
format
(
$name
,
"ERROR"
);
if
(
isset
(
$this
->
config
[
$name
]))
{
$args
.=
" - "
.
$this
->
formatter
->
format
(
$this
->
config
[
$name
],
'COMMENT'
);
if
(
isset
(
$this
->
_
config
[
$name
]))
{
$args
.=
" - "
.
$this
->
_formatter
->
format
(
$this
->
_
config
[
$name
],
'COMMENT'
);
}
else
{
$args
.=
" - "
.
$description
;
}
...
...
@@ -248,7 +262,7 @@ class Doctrine_Cli
}
if
(
$args
)
{
echo
"
\n
"
.
$this
->
formatter
->
format
(
'Arguments:'
,
'HEADER'
)
.
"
\n
"
.
$args
;
echo
"
\n
"
.
$this
->
_
formatter
->
format
(
'Arguments:'
,
'HEADER'
)
.
"
\n
"
.
$args
;
}
}
...
...
@@ -295,9 +309,9 @@ class Doctrine_Cli
}
}
$this
->
tasks
=
array_merge
(
$this
->
tasks
,
$tasks
);
$this
->
_tasks
=
array_merge
(
$this
->
_
tasks
,
$tasks
);
return
$this
->
tasks
;
return
$this
->
_
tasks
;
}
public
function
getLoadedTasks
()
...
...
@@ -318,6 +332,6 @@ class Doctrine_Cli
}
}
return
array_merge
(
$this
->
tasks
,
$tasks
);
return
array_merge
(
$this
->
_
tasks
,
$tasks
);
}
}
lib/Doctrine/Cli/AnsiColorFormatter.php
View file @
db10d4a0
...
...
@@ -37,126 +37,119 @@
*/
class
Doctrine_Cli_AnsiColorFormatter
extends
Doctrine_Cli_Formatter
{
protected
$
styles
=
array
(
'HEADER'
=>
array
(
'fg'
=>
'black'
,
'bold'
=>
true
),
'ERROR'
=>
array
(
'bg'
=>
'red'
,
'fg'
=>
'white'
,
'bold'
=>
true
),
'INFO'
=>
array
(
'fg'
=>
'green'
,
'bold'
=>
true
),
'COMMENT'
=>
array
(
'fg'
=>
'yellow'
),
),
$
options
=
array
(
'bold'
=>
1
,
'underscore'
=>
4
,
'blink'
=>
5
,
'reverse'
=>
7
,
'conceal'
=>
8
),
$
foreground
=
array
(
'black'
=>
30
,
'red'
=>
31
,
'green'
=>
32
,
'yellow'
=>
33
,
'blue'
=>
34
,
'magenta'
=>
35
,
'cyan'
=>
36
,
'white'
=>
37
),
$
background
=
array
(
'black'
=>
40
,
'red'
=>
41
,
'green'
=>
42
,
'yellow'
=>
43
,
'blue'
=>
44
,
'magenta'
=>
45
,
'cyan'
=>
46
,
'white'
=>
47
);
protected
$_
styles
=
array
(
'HEADER'
=>
array
(
'fg'
=>
'black'
,
'bold'
=>
true
),
'ERROR'
=>
array
(
'bg'
=>
'red'
,
'fg'
=>
'white'
,
'bold'
=>
true
),
'INFO'
=>
array
(
'fg'
=>
'green'
,
'bold'
=>
true
),
'COMMENT'
=>
array
(
'fg'
=>
'yellow'
),
),
$_
options
=
array
(
'bold'
=>
1
,
'underscore'
=>
4
,
'blink'
=>
5
,
'reverse'
=>
7
,
'conceal'
=>
8
),
$_
foreground
=
array
(
'black'
=>
30
,
'red'
=>
31
,
'green'
=>
32
,
'yellow'
=>
33
,
'blue'
=>
34
,
'magenta'
=>
35
,
'cyan'
=>
36
,
'white'
=>
37
),
$_
background
=
array
(
'black'
=>
40
,
'red'
=>
41
,
'green'
=>
42
,
'yellow'
=>
43
,
'blue'
=>
44
,
'magenta'
=>
45
,
'cyan'
=>
46
,
'white'
=>
47
);
/**
* Sets a new style.
*
* @param string The style name
* @param array An array of options
*/
public
function
setStyle
(
$name
,
$options
=
array
())
{
$this
->
styles
[
$name
]
=
$options
;
}
/**
* Formats a text according to the given style or parameters.
*
* @param string The test to style
* @param mixed An array of options or a style name
*
* @return string The styled text
*/
public
function
format
(
$text
=
''
,
$parameters
=
array
(),
$stream
=
STDOUT
)
{
if
(
!
$this
->
supportsColors
(
$stream
))
/**
* Sets a new style.
*
* @param string The style name
* @param array An array of options
*/
public
function
setStyle
(
$name
,
$options
=
array
())
{
return
$text
;
$this
->
_styles
[
$name
]
=
$options
;
}
if
(
!
is_array
(
$parameters
)
&&
'NONE'
==
$parameters
)
/**
* Formats a text according to the given style or parameters.
*
* @param string The test to style
* @param mixed An array of options or a style name
*
* @return string The styled text
*/
public
function
format
(
$text
=
''
,
$parameters
=
array
(),
$stream
=
STDOUT
)
{
return
$text
;
}
if
(
!
$this
->
supportsColors
(
$stream
))
{
return
$text
;
}
if
(
!
is_array
(
$parameters
)
&&
isset
(
$this
->
styles
[
$parameters
]))
{
$parameters
=
$this
->
styles
[
$parameters
];
}
if
(
!
is_array
(
$parameters
)
&&
'NONE'
==
$parameters
)
{
return
$text
;
}
$codes
=
array
();
if
(
isset
(
$parameters
[
'fg'
]))
{
$codes
[]
=
$this
->
foreground
[
$parameters
[
'fg'
]];
}
if
(
isset
(
$parameters
[
'bg'
]))
{
$codes
[]
=
$this
->
background
[
$parameters
[
'bg'
]];
if
(
!
is_array
(
$parameters
)
&&
isset
(
$this
->
_styles
[
$parameters
]))
{
$parameters
=
$this
->
_styles
[
$parameters
];
}
$codes
=
array
();
if
(
isset
(
$parameters
[
'fg'
]))
{
$codes
[]
=
$this
->
_foreground
[
$parameters
[
'fg'
]];
}
if
(
isset
(
$parameters
[
'bg'
]))
{
$codes
[]
=
$this
->
_background
[
$parameters
[
'bg'
]];
}
foreach
(
$this
->
_options
as
$option
=>
$value
)
{
if
(
isset
(
$parameters
[
$option
])
&&
$parameters
[
$option
])
{
$codes
[]
=
$value
;
}
}
return
"
\033
["
.
implode
(
';'
,
$codes
)
.
'm'
.
$text
.
"
\033
[0m"
;
}
foreach
(
$this
->
options
as
$option
=>
$value
)
/**
* Formats a message within a section.
*
* @param string The section name
* @param string The text message
* @param integer The maximum size allowed for a line (65 by default)
*/
public
function
formatSection
(
$section
,
$text
,
$size
=
null
)
{
if
(
isset
(
$parameters
[
$option
])
&&
$parameters
[
$option
])
{
$codes
[]
=
$value
;
}
$width
=
9
+
strlen
(
$this
->
format
(
''
,
'INFO'
));
return
sprintf
(
">> %-${width}s %s"
,
$this
->
format
(
$section
,
'INFO'
),
$this
->
excerpt
(
$text
,
$size
));
}
return
"
\033
["
.
implode
(
';'
,
$codes
)
.
'm'
.
$text
.
"
\033
[0m"
;
}
/**
* Truncates a line.
*
* @param string The text
* @param integer The maximum size of the returned string (65 by default)
*
* @return string The truncated string
*/
public
function
excerpt
(
$text
,
$size
=
null
)
{
if
(
!
$size
)
{
$size
=
$this
->
size
;
}
/**
* Formats a message within a section.
*
* @param string The section name
* @param string The text message
* @param integer The maximum size allowed for a line (65 by default)
*/
public
function
formatSection
(
$section
,
$text
,
$size
=
null
)
{
$width
=
9
+
strlen
(
$this
->
format
(
''
,
'INFO'
));
if
(
strlen
(
$text
)
<
$size
)
{
return
$text
;
}
return
sprintf
(
">> %-${width}s %s"
,
$this
->
format
(
$section
,
'INFO'
),
$this
->
excerpt
(
$text
,
$size
));
}
$subsize
=
floor
((
$size
-
3
)
/
2
);
/**
* Truncates a line.
*
* @param string The text
* @param integer The maximum size of the returned string (65 by default)
*
* @return string The truncated string
*/
public
function
excerpt
(
$text
,
$size
=
null
)
{
if
(
!
$size
)
{
$size
=
$this
->
size
;
return
substr
(
$text
,
0
,
$subsize
)
.
$this
->
format
(
'...'
,
'INFO'
)
.
substr
(
$text
,
-
$subsize
);
}
if
(
strlen
(
$text
)
<
$size
)
/**
* Returns true if the stream supports colorization.
*
* Colorization is disabled if not supported by the stream:
*
* - windows
* - non tty consoles
*
* @param mixed A stream
*
* @return Boolean true if the stream supports colorization, false otherwise
*/
public
function
supportsColors
(
$stream
)
{
return
$text
;
return
DIRECTORY_SEPARATOR
!=
'\\'
&&
function_exists
(
'posix_isatty'
)
&&
@
posix_isatty
(
$stream
)
;
}
$subsize
=
floor
((
$size
-
3
)
/
2
);
return
substr
(
$text
,
0
,
$subsize
)
.
$this
->
format
(
'...'
,
'INFO'
)
.
substr
(
$text
,
-
$subsize
);
}
/**
* Returns true if the stream supports colorization.
*
* Colorization is disabled if not supported by the stream:
*
* - windows
* - non tty consoles
*
* @param mixed A stream
*
* @return Boolean true if the stream supports colorization, false otherwise
*/
public
function
supportsColors
(
$stream
)
{
return
DIRECTORY_SEPARATOR
!=
'\\'
&&
function_exists
(
'posix_isatty'
)
&&
@
posix_isatty
(
$stream
);
}
}
\ No newline at end of file
lib/Doctrine/Cli/Formatter.php
View file @
db10d4a0
...
...
@@ -37,72 +37,75 @@
*/
class
Doctrine_Cli_Formatter
{
protected
$size
=
65
;
protected
$_size
=
65
;
function
__construct
(
$maxLineSize
=
65
)
{
$this
->
size
=
$maxLineSize
;
}
/**
* Formats a text according to the given parameters.
*
* @param string The test to style
* @param mixed An array of parameters
* @param stream A stream (default to STDOUT)
*
* @return string The formatted text
*/
public
function
format
(
$text
=
''
,
$parameters
=
array
(),
$stream
=
STDOUT
)
{
return
$text
;
}
/**
* Formats a message within a section.
*
* @param string The section name
* @param string The text message
* @param integer The maximum size allowed for a line (65 by default)
*/
public
function
formatSection
(
$section
,
$text
,
$size
=
null
)
{
return
sprintf
(
">> %-$9s %s"
,
$section
,
$this
->
excerpt
(
$text
,
$size
));
}
/**
* __construct
*
* @param string $maxLineSize
* @return void
*/
function
__construct
(
$maxLineSize
=
65
)
{
$this
->
_size
=
$maxLineSize
;
}
/**
* Truncates a line.
*
* @param string The text
* @param integer The maximum size of the returned string (65 by default)
*
* @return string The truncated string
*/
public
function
excerpt
(
$text
,
$size
=
null
)
{
if
(
!
$size
)
/**
* Formats a text according to the given parameters.
*
* @param string The test to style
* @param mixed An array of parameters
* @param stream A stream (default to STDOUT)
*
* @return string The formatted text
*/
public
function
format
(
$text
=
''
,
$parameters
=
array
(),
$stream
=
STDOUT
)
{
$size
=
$this
->
size
;
return
$text
;
}
if
(
strlen
(
$text
)
<
$size
)
/**
* Formats a message within a section.
*
* @param string The section name
* @param string The text message
* @param integer The maximum size allowed for a line (65 by default)
*/
public
function
formatSection
(
$section
,
$text
,
$size
=
null
)
{
return
$text
;
return
sprintf
(
">> %-$9s %s"
,
$section
,
$this
->
excerpt
(
$text
,
$size
))
;
}
$subsize
=
floor
((
$size
-
3
)
/
2
);
/**
* Truncates a line.
*
* @param string The text
* @param integer The maximum size of the returned string (65 by default)
*
* @return string The truncated string
*/
public
function
excerpt
(
$text
,
$size
=
null
)
{
if
(
!
$size
)
{
$size
=
$this
->
_size
;
}
if
(
strlen
(
$text
)
<
$size
)
{
return
$text
;
}
$subsize
=
floor
((
$size
-
3
)
/
2
);
return
substr
(
$text
,
0
,
$subsize
)
.
'...'
.
substr
(
$text
,
-
$subsize
);
}
return
substr
(
$text
,
0
,
$subsize
)
.
'...'
.
substr
(
$text
,
-
$subsize
);
}
/**
* Sets the maximum line size.
*
* @param integer The maximum line size for a message
*/
public
function
setMaxLineSize
(
$size
)
{
$this
->
size
=
$size
;
}
/**
* Sets the maximum line size.
*
* @param integer The maximum line size for a message
*/
public
function
setMaxLineSize
(
$size
)
{
$this
->
_
size
=
$size
;
}
}
\ No newline at end of file
lib/Doctrine/Data.php
View file @
db10d4a0
...
...
@@ -42,7 +42,7 @@ class Doctrine_Data
*
* @var string
*/
p
ublic
$
formats
=
array
(
'csv'
,
'yml'
,
'xml'
);
p
rotected
$_
formats
=
array
(
'csv'
,
'yml'
,
'xml'
);
/**
* format
...
...
@@ -51,7 +51,7 @@ class Doctrine_Data
*
* @var string
*/
p
ublic
$
format
=
'yml'
;
p
rotected
$_
format
=
'yml'
;
/**
* directory
...
...
@@ -60,7 +60,7 @@ class Doctrine_Data
*
* @var string
*/
p
ublic
$
directory
=
null
;
p
rotected
$_
directory
=
null
;
/**
* models
...
...
@@ -69,16 +69,16 @@ class Doctrine_Data
*
* @var string
*/
p
ublic
$
models
=
array
();
p
rotected
$_
models
=
array
();
/**
* exportIndividualFiles
*
_
exportIndividualFiles
*
* whether or not to export data to individual files instead of 1
*
* @var string
*/
p
ublic
$
exportIndividualFiles
=
false
;
p
rotected
$_
exportIndividualFiles
=
false
;
/**
* setFormat
...
...
@@ -90,7 +90,7 @@ class Doctrine_Data
*/
public
function
setFormat
(
$format
)
{
$this
->
format
=
$format
;
$this
->
_
format
=
$format
;
}
/**
...
...
@@ -102,7 +102,7 @@ class Doctrine_Data
*/
public
function
getFormat
()
{
return
$this
->
format
;
return
$this
->
_
format
;
}
/**
...
...
@@ -114,7 +114,7 @@ class Doctrine_Data
*/
public
function
getFormats
()
{
return
$this
->
formats
;
return
$this
->
_
formats
;
}
/**
...
...
@@ -126,7 +126,7 @@ class Doctrine_Data
*/
public
function
setDirectory
(
$directory
)
{
$this
->
directory
=
$directory
;
$this
->
_
directory
=
$directory
;
}
/**
...
...
@@ -138,7 +138,7 @@ class Doctrine_Data
*/
public
function
getDirectory
()
{
return
$this
->
directory
;
return
$this
->
_
directory
;
}
/**
...
...
@@ -151,7 +151,7 @@ class Doctrine_Data
*/
public
function
setModels
(
$models
)
{
$this
->
models
=
$models
;
$this
->
_
models
=
$models
;
}
/**
...
...
@@ -163,23 +163,23 @@ class Doctrine_Data
*/
public
function
getModels
()
{
return
$this
->
models
;
return
$this
->
_
models
;
}
/**
* exportIndividualFiles
*
_
exportIndividualFiles
*
* Set/Get whether or not to export individual files
*
* @return bool $exportIndividualFiles
* @return bool $
_
exportIndividualFiles
*/
public
function
exportIndividualFiles
(
$bool
=
null
)
{
if
(
$bool
!==
null
)
{
$this
->
exportIndividualFiles
=
$bool
;
$this
->
_
exportIndividualFiles
=
$bool
;
}
return
$this
->
exportIndividualFiles
;
return
$this
->
_
exportIndividualFiles
;
}
/**
...
...
@@ -190,15 +190,15 @@ class Doctrine_Data
* @param string $directory
* @param string $format
* @param string $models
* @param string $exportIndividualFiles
* @param string $
_
exportIndividualFiles
* @return void
*/
public
function
exportData
(
$directory
,
$format
=
'yml'
,
$models
=
array
(),
$exportIndividualFiles
=
false
)
public
function
exportData
(
$directory
,
$format
=
'yml'
,
$models
=
array
(),
$
_
exportIndividualFiles
=
false
)
{
$export
=
new
Doctrine_Data_Export
(
$directory
);
$export
->
setFormat
(
$format
);
$export
->
setModels
(
$models
);
$export
->
exportIndividualFiles
(
$exportIndividualFiles
);
$export
->
exportIndividualFiles
(
$
_
exportIndividualFiles
);
return
$export
->
doExport
();
}
...
...
lib/Doctrine/Data/Import.php
View file @
db10d4a0
...
...
@@ -52,7 +52,7 @@ class Doctrine_Data_Import extends Doctrine_Data
*/
public
function
doImport
()
{
$directory
=
$this
->
directory
;
$directory
=
$this
->
getDirectory
()
;
$array
=
array
();
...
...
lib/Doctrine/Import/Builder.php
View file @
db10d4a0
...
...
@@ -43,23 +43,23 @@ class Doctrine_Import_Builder
*
* the path where imported files are being generated
*
* @var string $path
* @var string $
_
path
*/
pr
ivate
$
path
=
''
;
pr
otected
$_
path
=
''
;
/**
* packagesPrefix
*
* @var string
*/
pr
ivate
$
packagesPrefix
=
'Package'
;
pr
otected
$_
packagesPrefix
=
'Package'
;
/**
* packagesPath
*
* @var string
*/
pr
ivate
$
packagesPath
=
''
;
pr
otected
$_
packagesPath
=
''
;
/**
* suffix
...
...
@@ -68,7 +68,7 @@ class Doctrine_Import_Builder
*
* @var string $suffix
*/
pr
ivate
$
suffix
=
'.class.php'
;
pr
otected
$_
suffix
=
'.class.php'
;
/**
* generateBaseClasses
...
...
@@ -77,14 +77,14 @@ class Doctrine_Import_Builder
*
* @var string $suffix
*/
pr
ivate
$
generateBaseClasses
=
true
;
pr
otected
$_
generateBaseClasses
=
true
;
/**
* generateTableClasses
*
* @var string
*/
pr
ivate
$
generateTableClasses
=
true
;
pr
otected
$_
generateTableClasses
=
true
;
/**
* baseClassesDirectory
...
...
@@ -93,23 +93,23 @@ class Doctrine_Import_Builder
*
* @var string $suffix
*/
pr
ivate
$
baseClassesDirectory
=
'generated'
;
pr
otected
$_
baseClassesDirectory
=
'generated'
;
/**
* baseClassName
*
* @var string
*/
pr
ivate
$
baseClassName
=
'Doctrine_Record'
;
pr
otected
$_
baseClassName
=
'Doctrine_Record'
;
/**
* tpl
*
* Class template used for writing classes
*
* @var $tpl
* @var $
_
tpl
*/
pr
ivate
static
$
tpl
;
pr
otected
static
$_
tpl
;
/**
* __construct
...
...
@@ -131,11 +131,11 @@ class Doctrine_Import_Builder
{
Doctrine
::
makeDirectories
(
$path
);
if
(
!
$this
->
packagesPath
)
{
$this
->
packagesPath
=
$path
.
DIRECTORY_SEPARATOR
.
'packages'
;
if
(
!
$this
->
_
packagesPath
)
{
$this
->
_
packagesPath
=
$path
.
DIRECTORY_SEPARATOR
.
'packages'
;
}
$this
->
path
=
$path
;
$this
->
_
path
=
$path
;
}
/**
...
...
@@ -146,7 +146,7 @@ class Doctrine_Import_Builder
*/
public
function
setPackagesPrefix
(
$packagesPrefix
)
{
$this
->
packagesPrefix
=
$packagesPrefix
;
$this
->
_
packagesPrefix
=
$packagesPrefix
;
}
/**
...
...
@@ -157,7 +157,7 @@ class Doctrine_Import_Builder
*/
public
function
setPackagesPath
(
$packagesPath
)
{
$this
->
packagesPath
=
$packagesPath
;
$this
->
_
packagesPath
=
$packagesPath
;
}
/**
...
...
@@ -171,10 +171,10 @@ class Doctrine_Import_Builder
public
function
generateBaseClasses
(
$bool
=
null
)
{
if
(
$bool
!==
null
)
{
$this
->
generateBaseClasses
=
$bool
;
$this
->
_
generateBaseClasses
=
$bool
;
}
return
$this
->
generateBaseClasses
;
return
$this
->
_
generateBaseClasses
;
}
/**
...
...
@@ -188,10 +188,10 @@ class Doctrine_Import_Builder
public
function
generateTableClasses
(
$bool
=
null
)
{
if
(
$bool
!==
null
)
{
$this
->
generateTableClasses
=
$bool
;
$this
->
_
generateTableClasses
=
$bool
;
}
return
$this
->
generateTableClasses
;
return
$this
->
_
generateTableClasses
;
}
/**
...
...
@@ -201,7 +201,7 @@ class Doctrine_Import_Builder
*/
public
function
setBaseClassesDirectory
(
$baseClassesDirectory
)
{
$this
->
baseClassesDirectory
;
$this
->
_
baseClassesDirectory
;
}
/**
...
...
@@ -211,7 +211,7 @@ class Doctrine_Import_Builder
*/
public
function
setBaseClassName
(
$className
)
{
$this
->
baseClassName
=
$className
;
$this
->
_
baseClassName
=
$className
;
}
/**
...
...
@@ -222,7 +222,7 @@ class Doctrine_Import_Builder
*/
public
function
setSuffix
(
$suffix
)
{
$this
->
suffix
=
$suffix
;
$this
->
_
suffix
=
$suffix
;
}
/**
...
...
@@ -232,7 +232,7 @@ class Doctrine_Import_Builder
*/
public
function
getTargetPath
()
{
return
$this
->
path
;
return
$this
->
_
path
;
}
/**
...
...
@@ -244,11 +244,11 @@ class Doctrine_Import_Builder
*/
public
function
loadTemplate
()
{
if
(
isset
(
self
::
$tpl
))
{
if
(
isset
(
self
::
$
_
tpl
))
{
return
;
}
self
::
$tpl
=<<<
END
self
::
$
_
tpl
=<<<
END
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
...
...
@@ -651,7 +651,7 @@ END;
$abstract
=
isset
(
$options
[
'abstract'
])
&&
$options
[
'abstract'
]
===
true
?
'abstract '
:
null
;
$className
=
$options
[
'className'
];
$extends
=
isset
(
$options
[
'inheritance'
][
'extends'
])
?
$options
[
'inheritance'
][
'extends'
]
:
$this
->
baseClassName
;
$extends
=
isset
(
$options
[
'inheritance'
][
'extends'
])
?
$options
[
'inheritance'
][
'extends'
]
:
$this
->
_
baseClassName
;
if
(
!
(
isset
(
$options
[
'no_definition'
])
&&
$options
[
'no_definition'
]
===
true
))
{
$definition
=
$this
->
buildTableDefinition
(
$options
,
$columns
,
$relations
,
$indexes
,
$attributes
,
$templates
,
$actAs
);
...
...
@@ -663,7 +663,7 @@ END;
$accessors
=
(
isset
(
$options
[
'generate_accessors'
])
&&
$options
[
'generate_accessors'
]
===
true
)
?
$this
->
buildAccessors
(
$options
,
$columns
)
:
null
;
$content
=
sprintf
(
self
::
$tpl
,
$abstract
,
$content
=
sprintf
(
self
::
$
_
tpl
,
$abstract
,
$className
,
$extends
,
$definition
,
...
...
@@ -708,7 +708,7 @@ END;
// If we have a package then we need to make this extend the package definition and not the base definition
// The package definition will then extends the base definition
$topLevel
[
'inheritance'
][
'extends'
]
=
(
isset
(
$topLevel
[
'package'
])
&&
$topLevel
[
'package'
])
?
$this
->
packagesPrefix
.
$topLevel
[
'className'
]
:
'Base'
.
$topLevel
[
'className'
];
$topLevel
[
'inheritance'
][
'extends'
]
=
(
isset
(
$topLevel
[
'package'
])
&&
$topLevel
[
'package'
])
?
$this
->
_
packagesPrefix
.
$topLevel
[
'className'
]
:
'Base'
.
$topLevel
[
'className'
];
$topLevel
[
'no_definition'
]
=
true
;
$topLevel
[
'generate_once'
]
=
true
;
$topLevel
[
'is_main_class'
]
=
true
;
...
...
@@ -754,7 +754,7 @@ END;
$className
=
$className
.
'Table'
;
$content
=
'<?php'
.
PHP_EOL
;
$content
.=
sprintf
(
self
::
$tpl
,
false
,
$content
.=
sprintf
(
self
::
$
_
tpl
,
false
,
$className
,
isset
(
$options
[
'extends'
])
?
$options
[
'extends'
]
:
'Doctrine_Table'
,
null
,
...
...
@@ -764,7 +764,7 @@ END;
Doctrine
::
makeDirectories
(
$path
);
$writePath
=
$path
.
DIRECTORY_SEPARATOR
.
$className
.
$this
->
suffix
;
$writePath
=
$path
.
DIRECTORY_SEPARATOR
.
$className
.
$this
->
_
suffix
;
if
(
!
file_exists
(
$writePath
))
{
file_put_contents
(
$writePath
,
$content
);
...
...
@@ -787,20 +787,20 @@ END;
{
$definition
=
$this
->
buildDefinition
(
$options
,
$columns
,
$relations
,
$indexes
,
$attributes
,
$templates
,
$actAs
);
$fileName
=
$options
[
'className'
]
.
$this
->
suffix
;
$fileName
=
$options
[
'className'
]
.
$this
->
_
suffix
;
$packagesPath
=
$this
->
packagesPath
?
$this
->
packagesPath
:
$this
->
path
;
$packagesPath
=
$this
->
_packagesPath
?
$this
->
_packagesPath
:
$this
->
_
path
;
// If this is a main class that either extends from Base or Package class
if
(
isset
(
$options
[
'is_main_class'
])
&&
$options
[
'is_main_class'
])
{
// If is package then we need to put it in a package subfolder
if
(
isset
(
$options
[
'is_package'
])
&&
$options
[
'is_package'
])
{
$writePath
=
$this
->
path
.
DIRECTORY_SEPARATOR
.
$options
[
'package_name'
];
$writePath
=
$this
->
_
path
.
DIRECTORY_SEPARATOR
.
$options
[
'package_name'
];
$this
->
writeTableDefinition
(
$options
[
'className'
],
$writePath
,
array
(
'extends'
=>
$options
[
'inheritance'
][
'extends'
]
.
'Table'
));
// Otherwise lets just put it in the root of the path
}
else
{
$writePath
=
$this
->
path
;
$writePath
=
$this
->
_
path
;
$this
->
writeTableDefinition
(
$options
[
'className'
],
$writePath
);
}
...
...
@@ -819,10 +819,10 @@ END;
if
(
isset
(
$options
[
'is_base_class'
])
&&
$options
[
'is_base_class'
])
{
// If it is a part of a package then we need to put it in a package subfolder
if
(
isset
(
$options
[
'is_package'
])
&&
$options
[
'is_package'
])
{
$writePath
=
$this
->
path
.
DIRECTORY_SEPARATOR
.
$options
[
'package_name'
]
.
DIRECTORY_SEPARATOR
.
$this
->
baseClassesDirectory
;
$writePath
=
$this
->
_path
.
DIRECTORY_SEPARATOR
.
$options
[
'package_name'
]
.
DIRECTORY_SEPARATOR
.
$this
->
_
baseClassesDirectory
;
// Otherwise lets just put it in the root generated folder
}
else
{
$writePath
=
$this
->
path
.
DIRECTORY_SEPARATOR
.
$this
->
baseClassesDirectory
;
$writePath
=
$this
->
_path
.
DIRECTORY_SEPARATOR
.
$this
->
_
baseClassesDirectory
;
}
}
...
...
@@ -831,9 +831,9 @@ END;
$writePath
.=
DIRECTORY_SEPARATOR
.
$fileName
;
}
else
{
Doctrine
::
makeDirectories
(
$this
->
path
);
Doctrine
::
makeDirectories
(
$this
->
_
path
);
$writePath
=
$this
->
path
.
DIRECTORY_SEPARATOR
.
$fileName
;
$writePath
=
$this
->
_
path
.
DIRECTORY_SEPARATOR
.
$fileName
;
}
$code
=
"<?php"
.
PHP_EOL
;
...
...
lib/Doctrine/Import/Schema.php
View file @
db10d4a0
...
...
@@ -39,14 +39,14 @@
*/
class
Doctrine_Import_Schema
{
protected
$relations
=
array
();
protected
$options
=
array
(
'packagesPrefix'
=>
'Package'
,
'packagesPath'
=>
''
,
'generateBaseClasses'
=>
true
,
'generateTableClasses'
=>
true
,
'baseClassesDirectory'
=>
'generated'
,
'baseClassName'
=>
'Doctrine_Record'
,
'suffix'
=>
'.class.php'
);
protected
$
_
relations
=
array
();
protected
$
_
options
=
array
(
'packagesPrefix'
=>
'Package'
,
'packagesPath'
=>
''
,
'generateBaseClasses'
=>
true
,
'generateTableClasses'
=>
true
,
'baseClassesDirectory'
=>
'generated'
,
'baseClassName'
=>
'Doctrine_Record'
,
'suffix'
=>
'.class.php'
);
/**
* getOption
...
...
@@ -56,8 +56,8 @@ class Doctrine_Import_Schema
*/
public
function
getOption
(
$name
)
{
if
(
isset
(
$this
->
options
[
$name
]))
{
return
$this
->
options
[
$name
];
if
(
isset
(
$this
->
_
options
[
$name
]))
{
return
$this
->
_
options
[
$name
];
}
}
...
...
@@ -70,10 +70,21 @@ class Doctrine_Import_Schema
*/
public
function
setOption
(
$name
,
$value
)
{
if
(
isset
(
$this
->
options
[
$name
]))
{
$this
->
options
[
$name
]
=
$value
;
if
(
isset
(
$this
->
_
options
[
$name
]))
{
$this
->
_
options
[
$name
]
=
$value
;
}
}
/**
* setOptions
*
* @param string $options
* @return void
*/
public
function
setOptions
(
$options
)
{
$this
->
_options
=
$options
;
}
/**
* buildSchema
...
...
@@ -106,7 +117,7 @@ class Doctrine_Import_Schema
$this
->
buildRelationships
(
$array
);
return
array
(
'schema'
=>
$array
,
'relations'
=>
$this
->
relations
);
return
array
(
'schema'
=>
$array
,
'relations'
=>
$this
->
_
relations
);
}
/**
...
...
@@ -199,7 +210,7 @@ class Doctrine_Import_Schema
*/
public
function
getRelations
(
$properties
)
{
return
isset
(
$this
->
relations
[
$properties
[
'className'
]])
?
$this
->
relations
[
$properties
[
'className'
]]
:
array
();
return
isset
(
$this
->
_relations
[
$properties
[
'className'
]])
?
$this
->
_
relations
[
$properties
[
'className'
]]
:
array
();
}
/**
...
...
@@ -385,7 +396,7 @@ class Doctrine_Import_Schema
$relation
[
'foreignType'
]
=
$relation
[
'foreignType'
]
===
'one'
?
Doctrine_Relation
::
ONE
:
Doctrine_Relation
::
MANY
;
}
$this
->
relations
[
$className
][
$alias
]
=
$relation
;
$this
->
_
relations
[
$className
][
$alias
]
=
$relation
;
}
}
...
...
@@ -402,7 +413,7 @@ class Doctrine_Import_Schema
*/
protected
function
fixRelationships
()
{
foreach
(
$this
->
relations
as
$className
=>
$relations
)
{
foreach
(
$this
->
_
relations
as
$className
=>
$relations
)
{
foreach
(
$relations
AS
$alias
=>
$relation
)
{
$newRelation
=
array
();
$newRelation
[
'foreign'
]
=
$relation
[
'local'
];
...
...
@@ -421,8 +432,8 @@ class Doctrine_Import_Schema
}
}
if
(
!
isset
(
$this
->
relations
[
$relation
[
'class'
]][
$newRelation
[
'alias'
]]))
{
$this
->
relations
[
$relation
[
'class'
]][
$newRelation
[
'alias'
]]
=
$newRelation
;
if
(
!
isset
(
$this
->
_
relations
[
$relation
[
'class'
]][
$newRelation
[
'alias'
]]))
{
$this
->
_
relations
[
$relation
[
'class'
]][
$newRelation
[
'alias'
]]
=
$newRelation
;
}
}
}
...
...
lib/Doctrine/Migration.php
View file @
db10d4a0
...
...
@@ -34,24 +34,23 @@
*/
class
Doctrine_Migration
{
protected
$changes
=
array
(
'created_tables'
=>
array
(),
'renamed_tables'
=>
array
(),
'created_constraints'
=>
array
(),
'dropped_fks'
=>
array
(),
'created_fks'
=>
array
(),
'dropped_constraints'
=>
array
(),
'removed_indexes'
=>
array
(),
'dropped_tables'
=>
array
(),
'added_columns'
=>
array
(),
'renamed_columns'
=>
array
(),
'changed_columns'
=>
array
(),
'removed_columns'
=>
array
(),
'added_indexes'
=>
array
(),
),
$migrationTableName
=
'migration_version'
,
$migrationClassesDirectory
=
array
(),
$migrationClasses
=
array
(),
$loadedMigrations
=
array
();
protected
$_changes
=
array
(
'created_tables'
=>
array
(),
'renamed_tables'
=>
array
(),
'created_constraints'
=>
array
(),
'dropped_fks'
=>
array
(),
'created_fks'
=>
array
(),
'dropped_constraints'
=>
array
(),
'removed_indexes'
=>
array
(),
'dropped_tables'
=>
array
(),
'added_columns'
=>
array
(),
'renamed_columns'
=>
array
(),
'changed_columns'
=>
array
(),
'removed_columns'
=>
array
(),
'added_indexes'
=>
array
()),
$_migrationTableName
=
'migration_version'
,
$_migrationClassesDirectory
=
array
(),
$_migrationClasses
=
array
(),
$_loadedMigrations
=
array
();
/**
* construct
...
...
@@ -65,7 +64,7 @@ class Doctrine_Migration
public
function
__construct
(
$directory
=
null
)
{
if
(
$directory
!=
null
)
{
$this
->
migrationClassesDirectory
=
$directory
;
$this
->
_
migrationClassesDirectory
=
$directory
;
$this
->
loadMigrationClasses
();
...
...
@@ -85,7 +84,7 @@ class Doctrine_Migration
$conn
=
Doctrine_Manager
::
connection
();
try
{
$conn
->
export
->
createTable
(
$this
->
migrationTableName
,
array
(
'version'
=>
array
(
'type'
=>
'integer'
,
'size'
=>
11
)));
$conn
->
export
->
createTable
(
$this
->
_
migrationTableName
,
array
(
'version'
=>
array
(
'type'
=>
'integer'
,
'size'
=>
11
)));
return
true
;
}
catch
(
Exception
$e
)
{
...
...
@@ -102,28 +101,28 @@ class Doctrine_Migration
*/
protected
function
loadMigrationClasses
()
{
if
(
$this
->
migrationClasses
)
{
return
$this
->
migrationClasses
;
if
(
$this
->
_
migrationClasses
)
{
return
$this
->
_
migrationClasses
;
}
$classes
=
get_declared_classes
();
if
(
$this
->
migrationClassesDirectory
!==
null
)
{
foreach
((
array
)
$this
->
migrationClassesDirectory
as
$dir
)
{
if
(
$this
->
_
migrationClassesDirectory
!==
null
)
{
foreach
((
array
)
$this
->
_
migrationClassesDirectory
as
$dir
)
{
$it
=
new
RecursiveIteratorIterator
(
new
RecursiveDirectoryIterator
(
$dir
),
RecursiveIteratorIterator
::
LEAVES_ONLY
);
foreach
(
$it
as
$file
)
{
$e
=
explode
(
'.'
,
$file
->
getFileName
());
if
(
end
(
$e
)
===
'php'
&&
strpos
(
$file
->
getFileName
(),
'.inc'
)
===
false
)
{
if
(
!
in_array
(
$file
->
getFileName
(),
$this
->
loadedMigrations
))
{
if
(
!
in_array
(
$file
->
getFileName
(),
$this
->
_
loadedMigrations
))
{
require_once
(
$file
->
getPathName
());
$requiredClass
=
array_diff
(
get_declared_classes
(),
$classes
);
$requiredClass
=
end
(
$requiredClass
);
if
(
$requiredClass
)
{
$this
->
loadedMigrations
[
$requiredClass
]
=
$file
->
getFileName
();
$this
->
_
loadedMigrations
[
$requiredClass
]
=
$file
->
getFileName
();
}
}
}
...
...
@@ -133,7 +132,7 @@ class Doctrine_Migration
$parent
=
new
ReflectionClass
(
'Doctrine_Migration'
);
foreach
(
$this
->
loadedMigrations
as
$name
=>
$fileName
)
{
foreach
(
$this
->
_
loadedMigrations
as
$name
=>
$fileName
)
{
$class
=
new
ReflectionClass
(
$name
);
while
(
$class
->
isSubclassOf
(
$parent
))
{
...
...
@@ -151,10 +150,10 @@ class Doctrine_Migration
$e
=
explode
(
'_'
,
$fileName
);
$classMigrationNum
=
(
int
)
$e
[
0
];
$this
->
migrationClasses
[
$classMigrationNum
]
=
array
(
'className'
=>
$name
,
'fileName'
=>
$fileName
);
$this
->
_
migrationClasses
[
$classMigrationNum
]
=
array
(
'className'
=>
$name
,
'fileName'
=>
$fileName
);
}
return
$this
->
migrationClasses
;
return
$this
->
_
migrationClasses
;
}
/**
...
...
@@ -164,7 +163,7 @@ class Doctrine_Migration
*/
public
function
getMigrationClasses
()
{
return
$this
->
migrationClasses
;
return
$this
->
_
migrationClasses
;
}
/**
...
...
@@ -180,9 +179,9 @@ class Doctrine_Migration
$conn
=
Doctrine_Manager
::
connection
();
if
(
$this
->
hasMigrated
())
{
$conn
->
exec
(
"UPDATE "
.
$this
->
migrationTableName
.
" SET version =
$number
"
);
$conn
->
exec
(
"UPDATE "
.
$this
->
_
migrationTableName
.
" SET version =
$number
"
);
}
else
{
$conn
->
exec
(
"INSERT INTO "
.
$this
->
migrationTableName
.
" (version) VALUES (
$number
)"
);
$conn
->
exec
(
"INSERT INTO "
.
$this
->
_
migrationTableName
.
" (version) VALUES (
$number
)"
);
}
}
...
...
@@ -197,7 +196,7 @@ class Doctrine_Migration
{
$conn
=
Doctrine_Manager
::
connection
();
$result
=
$conn
->
fetchColumn
(
"SELECT version FROM "
.
$this
->
migrationTableName
);
$result
=
$conn
->
fetchColumn
(
"SELECT version FROM "
.
$this
->
_
migrationTableName
);
return
isset
(
$result
[
0
])
?
$result
[
0
]
:
0
;
}
...
...
@@ -213,7 +212,7 @@ class Doctrine_Migration
{
$conn
=
Doctrine_Manager
::
connection
();
$result
=
$conn
->
fetchColumn
(
"SELECT version FROM "
.
$this
->
migrationTableName
);
$result
=
$conn
->
fetchColumn
(
"SELECT version FROM "
.
$this
->
_
migrationTableName
);
return
isset
(
$result
[
0
])
?
true
:
false
;
}
...
...
@@ -230,7 +229,7 @@ class Doctrine_Migration
$this
->
loadMigrationClasses
();
$versions
=
array
();
foreach
(
array_keys
(
$this
->
migrationClasses
)
as
$classMigrationNum
)
{
foreach
(
array_keys
(
$this
->
_
migrationClasses
)
as
$classMigrationNum
)
{
$versions
[
$classMigrationNum
]
=
$classMigrationNum
;
}
...
...
@@ -259,7 +258,7 @@ class Doctrine_Migration
*/
protected
function
getMigrationClass
(
$num
)
{
foreach
(
$this
->
migrationClasses
as
$classMigrationNum
=>
$info
)
{
foreach
(
$this
->
_
migrationClasses
as
$classMigrationNum
=>
$info
)
{
$className
=
$info
[
'className'
];
if
(
$classMigrationNum
==
$num
)
{
...
...
@@ -299,7 +298,7 @@ class Doctrine_Migration
if
(
method_exists
(
$this
,
$direction
))
{
$this
->
$direction
();
foreach
(
$this
->
changes
as
$type
=>
$changes
)
{
foreach
(
$this
->
_
changes
as
$type
=>
$changes
)
{
$process
=
new
Doctrine_Migration_Process
();
$funcName
=
'process'
.
Doctrine
::
classify
(
$type
);
...
...
@@ -359,7 +358,7 @@ class Doctrine_Migration
*/
protected
function
addChange
(
$type
,
array
$change
=
array
())
{
$this
->
changes
[
$type
][]
=
$change
;
$this
->
_
changes
[
$type
][]
=
$change
;
}
/**
...
...
lib/Doctrine/Task/GenerateMigration
Models
→
lib/Doctrine/Task/GenerateMigration
sModels.php
View file @
db10d4a0
File moved
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