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
975b74bd
Commit
975b74bd
authored
Oct 20, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enhancements to CLI and removing sandbox files. Will add ignores.
parent
8d2aebad
Changes
69
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
69 changed files
with
1187 additions
and
1114 deletions
+1187
-1114
Adapter.php
lib/Doctrine/Adapter.php
+1
-0
Cli.php
lib/Doctrine/Cli.php
+123
-52
AnsiColorFormatter.php
lib/Doctrine/Cli/AnsiColorFormatter.php
+162
-0
Formatter.php
lib/Doctrine/Cli/Formatter.php
+108
-0
FileFinder.php
lib/Doctrine/FileFinder.php
+746
-0
Migration.php
lib/Doctrine/Migration.php
+2
-2
Task.php
lib/Doctrine/Task.php
+15
-3
CreateTables.php
lib/Doctrine/Task/CreateTables.php
+2
-0
DropDb.php
lib/Doctrine/Task/DropDb.php
+2
-0
DumpData.php
lib/Doctrine/Task/DumpData.php
+2
-0
GenerateMigration.php
lib/Doctrine/Task/GenerateMigration.php
+2
-0
GenerateMigrationsFromDb.php
lib/Doctrine/Task/GenerateMigrationsFromDb.php
+2
-0
GenerateMigrationsFromModels.php
lib/Doctrine/Task/GenerateMigrationsFromModels.php
+2
-0
GenerateModelsFromDb.php
lib/Doctrine/Task/GenerateModelsFromDb.php
+2
-0
GenerateModelsFromYaml.php
lib/Doctrine/Task/GenerateModelsFromYaml.php
+2
-0
GenerateSql.php
lib/Doctrine/Task/GenerateSql.php
+2
-0
GenerateYamlFromDb.php
lib/Doctrine/Task/GenerateYamlFromDb.php
+2
-0
GenerateYamlFromModels.php
lib/Doctrine/Task/GenerateYamlFromModels.php
+2
-0
LoadData.php
lib/Doctrine/Task/LoadData.php
+2
-0
LoadDummyData.php
lib/Doctrine/Task/LoadDummyData.php
+2
-0
Migrate.php
lib/Doctrine/Task/Migrate.php
+3
-1
cli.php
sandbox/cli.php
+1
-1
adult.yml
sandbox/data/fixtures/adult.yml
+0
-5
car.yml
sandbox/data/fixtures/car.yml
+0
-8
child.yml
sandbox/data/fixtures/child.yml
+0
-5
data.yml
sandbox/data/fixtures/data.yml
+0
-8
dog.yml
sandbox/data/fixtures/dog.yml
+0
-11
self_reference.yml
sandbox/data/fixtures/self_reference.yml
+0
-20
user_car.yml
sandbox/data/fixtures/user_car.yml
+0
-11
001_add_adult.class.php
sandbox/migrations/001_add_adult.class.php
+0
-42
002_add_car.class.php
sandbox/migrations/002_add_car.class.php
+0
-37
003_add_child.class.php
sandbox/migrations/003_add_child.class.php
+0
-42
004_add_contact.class.php
sandbox/migrations/004_add_contact.class.php
+0
-37
005_add_dog.class.php
sandbox/migrations/005_add_dog.class.php
+0
-42
006_add_entity.class.php
sandbox/migrations/006_add_entity.class.php
+0
-32
007_add_groups.class.php
sandbox/migrations/007_add_groups.class.php
+0
-38
Adult.class.php
sandbox/models/Adult.class.php
+0
-12
Car.class.php
sandbox/models/Car.class.php
+0
-12
Child.class.php
sandbox/models/Child.class.php
+0
-12
Contact.class.php
sandbox/models/Contact.class.php
+0
-12
Dog.class.php
sandbox/models/Dog.class.php
+0
-12
Entity.class.php
sandbox/models/Entity.class.php
+0
-12
Group.class.php
sandbox/models/Group.class.php
+0
-12
SelfReference.class.php
sandbox/models/SelfReference.class.php
+0
-12
User.class.php
sandbox/models/User.class.php
+0
-12
UserCar.class.php
sandbox/models/UserCar.class.php
+0
-12
UserGroup.class.php
sandbox/models/UserGroup.class.php
+0
-12
BaseAdult.class.php
sandbox/models/generated/BaseAdult.class.php
+0
-34
BaseCar.class.php
sandbox/models/generated/BaseCar.class.php
+0
-30
BaseChild.class.php
sandbox/models/generated/BaseChild.class.php
+0
-31
BaseContact.class.php
sandbox/models/generated/BaseContact.class.php
+0
-32
BaseDog.class.php
sandbox/models/generated/BaseDog.class.php
+0
-31
BaseEntity.class.php
sandbox/models/generated/BaseEntity.class.php
+0
-22
BaseGroup.class.php
sandbox/models/generated/BaseGroup.class.php
+0
-31
BaseSelfReference.class.php
sandbox/models/generated/BaseSelfReference.class.php
+0
-52
BaseUser.class.php
sandbox/models/generated/BaseUser.class.php
+0
-51
BaseUserCar.class.php
sandbox/models/generated/BaseUserCar.class.php
+0
-31
BaseUserGroup.class.php
sandbox/models/generated/BaseUserGroup.class.php
+0
-31
adult.yml
sandbox/schema/adult.yml
+0
-17
car.yml
sandbox/schema/car.yml
+0
-15
child.yml
sandbox/schema/child.yml
+0
-17
contact.yml
sandbox/schema/contact.yml
+0
-11
dog.yml
sandbox/schema/dog.yml
+0
-17
entity.yml
sandbox/schema/entity.yml
+0
-8
group.yml
sandbox/schema/group.yml
+0
-18
self_reference.yml
sandbox/schema/self_reference.yml
+0
-40
user.yml
sandbox/schema/user.yml
+0
-38
user_car.yml
sandbox/schema/user_car.yml
+0
-14
user_group.yml
sandbox/schema/user_group.yml
+0
-14
No files found.
lib/Doctrine/Adapter.php
View file @
975b74bd
...
...
@@ -18,6 +18,7 @@
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.com>.
*/
/**
*
* Doctrine_Adapter
...
...
lib/Doctrine/Cli.php
View file @
975b74bd
...
...
@@ -32,10 +32,13 @@
*/
class
Doctrine_Cli
{
protected
$tasks
=
array
();
protected
$scriptName
=
null
;
protected
$config
=
array
();
protected
$tasks
=
array
(),
$taskInstance
=
null
,
$formatter
=
null
,
$scriptName
=
null
,
$message
=
null
,
$config
=
array
();
/**
* __construct
*
...
...
@@ -45,6 +48,29 @@ class Doctrine_Cli
public
function
__construct
(
$config
=
array
())
{
$this
->
config
=
$config
;
$this
->
formatter
=
new
Doctrine_Cli_AnsiColorFormatter
();
}
/**
* notify
*
* @param string $notification
* @return void
*/
public
function
notify
(
$notification
=
null
)
{
echo
$this
->
formatter
->
format
(
$this
->
taskInstance
->
getTaskName
(),
'INFO'
)
.
' - '
.
$this
->
formatter
->
format
(
$notification
,
'HEADER'
)
.
"
\n
"
;
}
/**
* notifyException
*
* @param string $exception
* @return void
*/
public
function
notifyException
(
$exception
)
{
echo
$this
->
formatter
->
format
(
$exception
->
getMessage
(),
'ERROR'
)
.
"
\n
"
;
}
/**
...
...
@@ -56,43 +82,79 @@ class Doctrine_Cli
*/
public
function
run
(
$args
)
{
echo
"
\n
"
;
try
{
$this
->
_run
(
$args
);
}
catch
(
Exception
$exception
)
{
$this
->
notifyException
(
$exception
);
}
echo
"
\n
"
;
}
protected
function
_getTaskClassFromArgs
(
$args
)
{
$taskName
=
str_replace
(
'-'
,
'_'
,
$args
[
1
]);
$taskClass
=
'Doctrine_Task_'
.
Doctrine
::
classify
(
$taskName
);
return
$taskClass
;
}
protected
function
_run
(
$args
)
{
$this
->
scriptName
=
$args
[
0
];
$taskName
=
$args
[
1
];
$arg1
=
isset
(
$args
[
1
])
?
$args
[
1
]
:
null
;
if
(
!
$arg1
||
$arg1
==
'help'
)
{
echo
$this
->
printTasks
(
null
,
$arg1
==
'help'
?
true
:
false
);
return
;
}
if
(
!
isset
(
$args
[
1
])
)
{
echo
$this
->
printTasks
();
if
(
isset
(
$args
[
1
])
&&
isset
(
$args
[
2
])
&&
$args
[
2
]
==
'help'
)
{
echo
$this
->
printTasks
(
$args
[
1
],
true
);
return
;
}
$taskClass
=
$this
->
_getTaskClassFromArgs
(
$args
);
if
(
!
class_exists
(
$taskClass
))
{
throw
new
Doctrine_Cli_Exception
(
'Cli task could not be found: '
.
$taskClass
);
}
unset
(
$args
[
0
]);
$taskName
=
str_replace
(
'-'
,
'_'
,
$args
[
1
]);
unset
(
$args
[
1
]);
$t
askClass
=
'Doctrine_Task_'
.
Doctrine
::
classify
(
$taskName
);
$t
his
->
taskInstance
=
new
$taskClass
(
$this
);
if
(
class_exists
(
$taskClass
))
{
$taskInstance
=
new
$taskClass
();
$args
=
$this
->
prepareArgs
(
$taskInstance
,
$args
);
$taskInstance
->
setArguments
(
$args
);
if
(
$taskInstance
->
validate
())
{
$taskInstance
->
execute
();
$args
=
$this
->
prepareArgs
(
$args
);
$this
->
taskInstance
->
setArguments
(
$args
);
try
{
if
(
$this
->
taskInstance
->
validate
())
{
$this
->
taskInstance
->
execute
();
}
else
{
echo
$this
->
formatter
->
format
(
'Requires arguments missing!!'
,
'ERROR'
)
.
"
\n\n
"
;
echo
$this
->
printTasks
(
$taskName
,
true
);
}
}
else
{
throw
new
Doctrine_Cli_Exception
(
'Cli task could not be found: '
.
$taskClass
);
}
catch
(
Exception
$e
)
{
throw
new
Doctrine_Cli_Exception
(
$e
->
getMessage
()
);
}
}
/**
* prepareArgs
*
* @param string $taskInstance
* @param string $args
* @return array $prepared
*/
protected
function
prepareArgs
(
$
taskInstance
,
$
args
)
protected
function
prepareArgs
(
$args
)
{
$taskInstance
=
$this
->
taskInstance
;
$args
=
array_values
(
$args
);
// First lets load populate an array with all the possible arguments. required and optional
...
...
@@ -137,54 +199,63 @@ class Doctrine_Cli
*
* @return void
*/
public
function
printTasks
()
public
function
printTasks
(
$task
=
null
,
$full
=
false
)
{
$task
=
Doctrine
::
classify
(
str_replace
(
'-'
,
'_'
,
$task
));
$tasks
=
$this
->
loadTasks
();
echo
"
\n
Available Doctrine Command Line Interface Tasks
\n
"
;
echo
str_repeat
(
'-'
,
40
)
.
"
\n\n
"
;
echo
$this
->
formatter
->
format
(
"Doctrine Command Line Interface"
,
'HEADER'
)
.
"
\n\n
"
;
foreach
(
$tasks
as
$taskName
)
{
if
(
$task
!=
null
&&
strtolower
(
$task
)
!=
strtolower
(
$taskName
))
{
continue
;
}
$className
=
'Doctrine_Task_'
.
$taskName
;
$taskInstance
=
new
$className
();
$taskInstance
->
taskName
=
str_replace
(
'_'
,
'-'
,
Doctrine
::
tableize
(
$taskName
));
echo
$taskInstance
->
getDescription
()
.
"
\n
"
;
$syntax
=
"Syntax: "
;
$taskInstance
->
taskName
=
str_replace
(
'_'
,
'-'
,
Doctrine
::
tableize
(
$taskName
));
$syntax
.=
$this
->
scriptName
.
' '
.
$taskInstance
->
getTaskName
();
if
(
$required
=
$taskInstance
->
getRequiredArguments
())
{
$syntax
.=
' <'
.
implode
(
'> <'
,
$required
)
.
'>'
;
}
if
(
$optional
=
$taskInstance
->
getOptionalArguments
())
{
$syntax
.=
' <'
.
implode
(
'> <'
,
$optional
)
.
'>'
;
}
$syntax
=
$this
->
scriptName
.
' '
.
$taskInstance
->
getTaskName
();
echo
$
syntax
.
"
\n
"
;
echo
$
this
->
formatter
->
format
(
$syntax
,
'INFO'
);
$args
=
null
;
if
(
$requiredArguments
=
$taskInstance
->
getRequiredArgumentsDescriptions
())
{
foreach
(
$requiredArguments
as
$name
=>
$description
)
{
$args
.=
'*'
.
$name
.
' - '
.
$description
.
"
\n
"
;
if
(
$full
)
{
echo
" - "
.
$taskInstance
->
getDescription
()
.
"
\n
"
;
$args
=
null
;
$requiredArguments
=
$taskInstance
->
getRequiredArgumentsDescriptions
();
if
(
!
empty
(
$requiredArguments
))
{
foreach
(
$requiredArguments
as
$name
=>
$description
)
{
$args
.=
$this
->
formatter
->
format
(
$name
,
"ERROR"
);
if
(
isset
(
$this
->
config
[
$name
]))
{
$args
.=
" - "
.
$this
->
formatter
->
format
(
$this
->
config
[
$name
],
'COMMENT'
);
}
else
{
$args
.=
" - "
.
$description
;
}
$args
.=
"
\n
"
;
}
}
}
if
(
$optionalArguments
=
$taskInstance
->
getOptionalArgumentsDescriptions
())
{
foreach
(
$optionalArguments
as
$name
=>
$description
)
{
$args
.=
$name
.
' - '
.
$description
.
"
\n
"
;
$optionalArguments
=
$taskInstance
->
getOptionalArgumentsDescriptions
();
if
(
!
empty
(
$optionalArguments
))
{
foreach
(
$optionalArguments
as
$name
=>
$description
)
{
$args
.=
$name
.
' - '
.
$description
.
"
\n
"
;
}
}
}
if
(
$args
)
{
echo
"
\n
Arguments (* = required):
\n
"
;
echo
$args
;
if
(
$args
)
{
echo
"
\n
"
.
$this
->
formatter
->
format
(
'Arguments:'
,
'HEADER'
)
.
"
\n
"
.
$args
;
}
}
echo
"
\n
"
.
str_repeat
(
"-"
,
40
)
.
"
\n
"
;
echo
"
\n
"
;
}
}
...
...
lib/Doctrine/Cli/AnsiColorFormatter.php
0 → 100644
View file @
975b74bd
<?php
/*
* This file is part of the symfony package.
* (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* $Id: AnsiColorFormatter.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.com>.
*/
/**
* Doctrine_AnsiColorFormatter provides methods to colorize text to be displayed on a console.
*
* @package Doctrine
* @subpackage Cli
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @version SVN: $Id: sfAnsiColorFormatter.class.php 5250 2007-09-24 08:11:50Z fabien $
*/
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
);
/**
* 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
))
{
return
$text
;
}
if
(
!
is_array
(
$parameters
)
&&
'NONE'
==
$parameters
)
{
return
$text
;
}
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"
;
}
/**
* 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'
));
return
sprintf
(
">> %-${width}s %s"
,
$this
->
format
(
$section
,
'INFO'
),
$this
->
excerpt
(
$text
,
$size
));
}
/**
* 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
)
.
$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
0 → 100644
View file @
975b74bd
<?php
/*
* This file is part of the symfony package.
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/*
* $Id: Formatter.php 2702 2007-10-03 21:43:22Z Jonathan.Wage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.com>.
*/
/**
* Doctrine_Cli_Formatter provides methods to format text to be displayed on a console.
*
* @package Doctrine
* @subpackage Cli
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @version SVN: $Id: Doctrine_Cli_Formatter.class.php 5250 2007-09-24 08:11:50Z fabien $
*/
class
Doctrine_Cli_Formatter
{
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
));
}
/**
* 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
);
}
/**
* 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/FileFinder.php
0 → 100644
View file @
975b74bd
This diff is collapsed.
Click to expand it.
lib/Doctrine/Migration.php
View file @
975b74bd
...
...
@@ -326,7 +326,7 @@ class Doctrine_Migration
}
if
(
$from
==
$to
)
{
throw
new
Doctrine_Migration_Exception
(
'Already at version
:
'
.
$to
);
throw
new
Doctrine_Migration_Exception
(
'Already at version
#
'
.
$to
);
}
$direction
=
$from
>
$to
?
'down'
:
'up'
;
...
...
@@ -343,7 +343,7 @@ class Doctrine_Migration
$this
->
setCurrentVersion
(
$to
);
return
true
;
return
$to
;
}
/**
...
...
lib/Doctrine/Task.php
View file @
975b74bd
...
...
@@ -34,7 +34,8 @@
*/
abstract
class
Doctrine_Task
{
public
$taskName
=
null
,
public
$dispatcher
=
null
,
$taskName
=
null
,
$description
=
null
,
$arguments
=
array
(),
$requiredArguments
=
array
(),
...
...
@@ -48,11 +49,22 @@ abstract class Doctrine_Task
*
* @return void
*/
public
function
__construct
()
public
function
__construct
(
$dispatcher
=
null
)
{
$this
->
dispatcher
=
$dispatcher
;
$this
->
taskName
=
str_replace
(
'_'
,
'-'
,
Doctrine
::
tableize
(
str_replace
(
'Doctrine_Task_'
,
''
,
get_class
(
$this
))));
}
public
function
notify
(
$message
)
{
if
(
is_object
(
$message
))
{
return
$message
->
notify
(
$message
);
}
else
{
return
$message
;
}
}
/**
* execute
*
...
...
@@ -76,7 +88,7 @@ abstract class Doctrine_Task
foreach
(
$requiredArguments
as
$arg
)
{
if
(
!
isset
(
$this
->
arguments
[
$arg
]))
{
throw
new
Doctrine_Task_Exception
(
'Required arguments missing. The follow arguments are required: '
.
implode
(
', '
,
$requiredArguments
))
;
return
false
;
}
}
...
...
lib/Doctrine/Task/CreateTables.php
View file @
975b74bd
...
...
@@ -39,5 +39,7 @@ class Doctrine_Task_CreateTables extends Doctrine_Task
public
function
execute
()
{
Doctrine
::
createTablesFromModels
(
$this
->
getArgument
(
'models_path'
));
$this
->
dispatcher
->
notify
(
'successfully created tables'
);
}
}
\ No newline at end of file
lib/Doctrine/Task/DropDb.php
View file @
975b74bd
...
...
@@ -39,5 +39,7 @@ class Doctrine_Task_DropDb extends Doctrine_Task
public
function
execute
()
{
Doctrine
::
dropDatabases
(
$this
->
getArgument
(
'connection'
));
$this
->
dispatcher
->
notify
(
'Successfully dropped all databases'
);
}
}
\ No newline at end of file
lib/Doctrine/Task/DumpData.php
View file @
975b74bd
...
...
@@ -54,5 +54,7 @@ class Doctrine_Task_DumpData extends Doctrine_Task
}
Doctrine
::
dumpData
(
$path
,
$individualFiles
);
$this
->
dispatcher
->
notify
(
sprintf
(
'successfully dumped data to %s'
,
$path
));
}
}
\ No newline at end of file
lib/Doctrine/Task/GenerateMigration.php
View file @
975b74bd
...
...
@@ -40,5 +40,7 @@ class Doctrine_Task_GenerateMigration extends Doctrine_Task
public
function
execute
()
{
Doctrine
::
generateMigrationClass
(
$this
->
getArgument
(
'class_name'
),
$this
->
getArgument
(
'migrations_path'
));
$this
->
dispatcher
->
notify
(
sprintf
(
'successfully generated migration class: %s to %s'
,
$this
->
getArgument
(
'class_name'
),
$this
->
getArgument
(
'migrations_path'
)));
}
}
\ No newline at end of file
lib/Doctrine/Task/GenerateMigrationsFromDb.php
View file @
975b74bd
...
...
@@ -39,5 +39,7 @@ class Doctrine_Task_GenerateMigrationsFromDb extends Doctrine_Task
public
function
execute
()
{
Doctrine
::
generateMigrationsFromDb
(
$this
->
getArgument
(
'migrations_path'
));
$this
->
dispatcher
->
notify
(
'successfully generated migration classes from databases'
);
}
}
\ No newline at end of file
lib/Doctrine/Task/GenerateMigrationsFromModels.php
View file @
975b74bd
...
...
@@ -40,5 +40,7 @@ class Doctrine_Task_GenerateMigrationsFromModels extends Doctrine_Task
public
function
execute
()
{
Doctrine
::
generateMigrationsFromModels
(
$this
->
getArgument
(
'migrations_path'
),
$this
->
getArgument
(
'models_path'
));
$this
->
dispatcher
->
notify
(
'successfully generated migrations from models'
);
}
}
\ No newline at end of file
lib/Doctrine/Task/GenerateModelsFromDb.php
View file @
975b74bd
...
...
@@ -39,5 +39,7 @@ class Doctrine_Task_GenerateModelsFromDb extends Doctrine_Task
public
function
execute
()
{
Doctrine
::
generateModelsFromDb
(
$this
->
getArgument
(
'models_path'
),
(
array
)
$this
->
getArgument
(
'connection'
));
$this
->
dispatcher
->
notify
(
'successfully generated models from databases'
);
}
}
\ No newline at end of file
lib/Doctrine/Task/GenerateModelsFromYaml.php
View file @
975b74bd
...
...
@@ -40,5 +40,7 @@ class Doctrine_Task_GenerateModelsFromYaml extends Doctrine_Task
public
function
execute
()
{
Doctrine
::
generateModelsFromYaml
(
$this
->
getArgument
(
'yaml_schema_path'
),
$this
->
getArgument
(
'models_path'
));
$this
->
dispatcher
->
notify
(
'successfully generated models from yaml'
);
}
}
\ No newline at end of file
lib/Doctrine/Task/GenerateSql.php
View file @
975b74bd
...
...
@@ -50,5 +50,7 @@ class Doctrine_Task_GenerateSql extends Doctrine_Task
$sql
=
Doctrine
::
generateSqlFromModels
(
$this
->
getArgument
(
'models_path'
));
file_put_contents
(
$path
,
$sql
);
$this
->
dispatcher
->
notify
(
'successfully generated sql for models'
);
}
}
\ No newline at end of file
lib/Doctrine/Task/GenerateYamlFromDb.php
View file @
975b74bd
...
...
@@ -39,5 +39,7 @@ class Doctrine_Task_GenerateYamlFromDb extends Doctrine_Task
public
function
execute
()
{
Doctrine
::
generateYamlFromDb
(
$this
->
getArgument
(
'yaml_schema_path'
));
$this
->
dispatcher
->
notify
(
'successfully generated yaml schema from databases'
);
}
}
\ No newline at end of file
lib/Doctrine/Task/GenerateYamlFromModels.php
View file @
975b74bd
...
...
@@ -40,5 +40,7 @@ class Doctrine_Task_GenerateYamlFromModels extends Doctrine_Task
public
function
execute
()
{
Doctrine
::
generateYamlFromModels
(
$this
->
getArgument
(
'yaml_schema_path'
),
$this
->
getArgument
(
'models_path'
));
$this
->
dispatcher
->
notify
(
'successfully generated yaml schema from models'
);
}
}
\ No newline at end of file
lib/Doctrine/Task/LoadData.php
View file @
975b74bd
...
...
@@ -41,5 +41,7 @@ class Doctrine_Task_LoadData extends Doctrine_Task
{
Doctrine
::
loadModels
(
$this
->
getArgument
(
'models_path'
));
Doctrine
::
loadData
(
$this
->
getArgument
(
'data_fixtures_path'
));
$this
->
dispatcher
->
notify
(
'data was successfully loaded'
);
}
}
\ No newline at end of file
lib/Doctrine/Task/LoadDummyData.php
View file @
975b74bd
...
...
@@ -41,5 +41,7 @@ class Doctrine_Task_LoadDummyData extends Doctrine_Task
{
Doctrine
::
loadModels
(
$this
->
getArgument
(
'models_path'
));
Doctrine
::
loadDummyData
(
$this
->
getArgument
(
'append'
)
?
true
:
false
,
$this
->
getArgument
(
'num'
)
?
$this
->
getArgument
(
'num'
)
:
5
);
$this
->
dispatcher
->
notify
(
'dummy data successfully loaded'
);
}
}
\ No newline at end of file
lib/Doctrine/Task/Migrate.php
View file @
975b74bd
...
...
@@ -38,6 +38,8 @@ class Doctrine_Task_Migrate extends Doctrine_Task
public
function
execute
()
{
Doctrine
::
migrate
(
$this
->
getArgument
(
'migrations_path'
),
$this
->
getArgument
(
'version'
));
$version
=
Doctrine
::
migrate
(
$this
->
getArgument
(
'migrations_path'
),
$this
->
getArgument
(
'version'
));
$this
->
dispatcher
->
notify
(
'migrated to version # '
.
$version
);
}
}
\ No newline at end of file
sandbox/cli.php
View file @
975b74bd
...
...
@@ -10,4 +10,4 @@ $config = array('data_fixtures_path' => DATA_FIXTURES_PATH,
'yaml_schema_path'
=>
YAML_SCHEMA_PATH
);
$cli
=
new
Doctrine_Cli
(
$config
);
$cli
->
run
(
$_SERVER
[
'argv'
]);
\ No newline at end of file
$cli
->
run
(
$_SERVER
[
'argv'
]);
sandbox/data/fixtures/adult.yml
deleted
100644 → 0
View file @
8d2aebad
---
Adult
:
Adult_1
:
name
:
Parent 1
Contact
:
Contact_1
\ No newline at end of file
sandbox/data/fixtures/car.yml
deleted
100644 → 0
View file @
8d2aebad
---
Car
:
Car_1
:
name
:
Chevorlet Trailblazer
Car_2
:
name
:
Chevorlet Blazer
Car_3
:
name
:
Buick
\ No newline at end of file
sandbox/data/fixtures/child.yml
deleted
100644 → 0
View file @
8d2aebad
---
Child
:
Child_1
:
name
:
Child 1
Adult
:
Adult_1
\ No newline at end of file
sandbox/data/fixtures/data.yml
deleted
100644 → 0
View file @
8d2aebad
---
Contact
:
Contact_1
:
name
:
jonathan h. wage
User
:
User_1
:
username
:
jonwage
Contact
:
Contact_1
sandbox/data/fixtures/dog.yml
deleted
100644 → 0
View file @
8d2aebad
---
Dog
:
Dog_1
:
name
:
Sam
User
:
User_1
Dog_2
:
name
:
Dixie
User
:
User_2
Dog_3
:
name
:
Chief
User
:
User_3
\ No newline at end of file
sandbox/data/fixtures/self_reference.yml
deleted
100644 → 0
View file @
8d2aebad
---
SelfReference
:
SelfReference_1
:
User1
:
User_1
User2
:
User_2
name
:
Self Reference 1
SelfReference1
:
SelfReference_2
SelfReference2
:
SelfReference_3
SelfReference_2
:
User1
:
User_2
User2
:
User_1
name
:
Self Reference 2
SelfReference1
:
SelfReference_1
SelfReference2
:
SelfReference_1
SelfReference_3
:
User1
:
User_2
User2
:
User_1
name
:
Self Reference 3
SelfReference1
:
SelfReference_3
SelfReference2
:
SelfReference_3
\ No newline at end of file
sandbox/data/fixtures/user_car.yml
deleted
100644 → 0
View file @
8d2aebad
---
UserCar
:
UserCar_1
:
User
:
User_1
Car
:
Car_1
UserCar_2
:
User
:
User_2
Car
:
Car_2
UserCar_3
:
User
:
User_3
Car
:
Car_3
\ No newline at end of file
sandbox/migrations/001_add_adult.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
AddAdult
extends
Doctrine_Migration
{
public
function
up
()
{
$this
->
createTable
(
'adult'
,
array
(
'id'
=>
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
,
'type'
=>
'integer'
,
'length'
=>
11
,
),
'name'
=>
array
(
'type'
=>
'string'
,
'length'
=>
255
,
),
'contact_id'
=>
array
(
'type'
=>
'integer'
,
'length'
=>
11
,
),
),
array
(
'indexes'
=>
array
(
),
'primary'
=>
array
(
0
=>
'id'
,
),
));
}
public
function
down
()
{
$this
->
dropTable
(
'adult'
);
}
}
\ No newline at end of file
sandbox/migrations/002_add_car.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
AddCar
extends
Doctrine_Migration
{
public
function
up
()
{
$this
->
createTable
(
'car'
,
array
(
'id'
=>
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
,
'type'
=>
'integer'
,
'length'
=>
11
,
),
'name'
=>
array
(
'type'
=>
'string'
,
'length'
=>
255
,
),
),
array
(
'indexes'
=>
array
(
),
'primary'
=>
array
(
0
=>
'id'
,
),
));
}
public
function
down
()
{
$this
->
dropTable
(
'car'
);
}
}
\ No newline at end of file
sandbox/migrations/003_add_child.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
AddChild
extends
Doctrine_Migration
{
public
function
up
()
{
$this
->
createTable
(
'child'
,
array
(
'id'
=>
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
,
'type'
=>
'integer'
,
'length'
=>
11
,
),
'name'
=>
array
(
'type'
=>
'string'
,
'length'
=>
255
,
),
'adult_id'
=>
array
(
'type'
=>
'integer'
,
'length'
=>
11
,
),
),
array
(
'indexes'
=>
array
(
),
'primary'
=>
array
(
0
=>
'id'
,
),
));
}
public
function
down
()
{
$this
->
dropTable
(
'child'
);
}
}
\ No newline at end of file
sandbox/migrations/004_add_contact.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
AddContact
extends
Doctrine_Migration
{
public
function
up
()
{
$this
->
createTable
(
'contact'
,
array
(
'id'
=>
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
,
'type'
=>
'integer'
,
'length'
=>
11
,
),
'name'
=>
array
(
'type'
=>
'string'
,
'length'
=>
255
,
),
),
array
(
'indexes'
=>
array
(
),
'primary'
=>
array
(
0
=>
'id'
,
),
));
}
public
function
down
()
{
$this
->
dropTable
(
'contact'
);
}
}
\ No newline at end of file
sandbox/migrations/005_add_dog.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
AddDog
extends
Doctrine_Migration
{
public
function
up
()
{
$this
->
createTable
(
'dog'
,
array
(
'id'
=>
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
,
'type'
=>
'integer'
,
'length'
=>
11
,
),
'name'
=>
array
(
'type'
=>
'string'
,
'length'
=>
255
,
),
'user_id'
=>
array
(
'type'
=>
'integer'
,
'length'
=>
11
,
),
),
array
(
'indexes'
=>
array
(
),
'primary'
=>
array
(
0
=>
'id'
,
),
));
}
public
function
down
()
{
$this
->
dropTable
(
'dog'
);
}
}
\ No newline at end of file
sandbox/migrations/006_add_entity.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
AddEntity
extends
Doctrine_Migration
{
public
function
up
()
{
$this
->
createTable
(
'entity'
,
array
(
'id'
=>
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
,
'type'
=>
'integer'
,
'length'
=>
11
,
),
),
array
(
'indexes'
=>
array
(
),
'primary'
=>
array
(
0
=>
'id'
,
),
));
}
public
function
down
()
{
$this
->
dropTable
(
'entity'
);
}
}
\ No newline at end of file
sandbox/migrations/007_add_groups.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
AddGroups
extends
Doctrine_Migration
{
public
function
up
()
{
$this
->
createTable
(
'groups'
,
array
(
'id'
=>
array
(
'notnull'
=>
true
,
'primary'
=>
true
,
'autoincrement'
=>
true
,
'type'
=>
'integer'
,
'length'
=>
11
,
),
'name'
=>
array
(
'type'
=>
'string'
,
'length'
=>
255
,
),
),
array
(
'indexes'
=>
array
(
),
'primary'
=>
array
(
0
=>
'id'
,
),
));
}
public
function
down
()
{
$this
->
dropTable
(
'groups'
);
}
}
\ No newline at end of file
sandbox/models/Adult.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
require_once
(
'generated/BaseAdult.class.php'
);
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
Adult
extends
BaseAdult
{
}
\ No newline at end of file
sandbox/models/Car.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
require_once
(
'generated/BaseCar.class.php'
);
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
Car
extends
BaseCar
{
}
\ No newline at end of file
sandbox/models/Child.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
require_once
(
'generated/BaseChild.class.php'
);
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
Child
extends
BaseChild
{
}
\ No newline at end of file
sandbox/models/Contact.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
require_once
(
'generated/BaseContact.class.php'
);
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
Contact
extends
BaseContact
{
}
\ No newline at end of file
sandbox/models/Dog.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
require_once
(
'generated/BaseDog.class.php'
);
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
Dog
extends
BaseDog
{
}
\ No newline at end of file
sandbox/models/Entity.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
require_once
(
'generated/BaseEntity.class.php'
);
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
Entity
extends
BaseEntity
{
}
\ No newline at end of file
sandbox/models/Group.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
require_once
(
'generated/BaseGroup.class.php'
);
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
Group
extends
BaseGroup
{
}
\ No newline at end of file
sandbox/models/SelfReference.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
require_once
(
'generated/BaseSelfReference.class.php'
);
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
SelfReference
extends
BaseSelfReference
{
}
\ No newline at end of file
sandbox/models/User.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
require_once
(
'generated/BaseUser.class.php'
);
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
User
extends
BaseUser
{
}
\ No newline at end of file
sandbox/models/UserCar.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
require_once
(
'generated/BaseUserCar.class.php'
);
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
UserCar
extends
BaseUserCar
{
}
\ No newline at end of file
sandbox/models/UserGroup.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
require_once
(
'generated/BaseUserGroup.class.php'
);
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class
UserGroup
extends
BaseUserGroup
{
}
\ No newline at end of file
sandbox/models/generated/BaseAdult.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
abstract
class
BaseAdult
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'adult'
);
$this
->
hasColumn
(
'id'
,
'integer'
,
11
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
$this
->
hasColumn
(
'name'
,
'string'
,
255
);
$this
->
hasColumn
(
'contact_id'
,
'integer'
,
11
);
}
public
function
setUp
()
{
$this
->
hasOne
(
'Contact'
,
array
(
'local'
=>
'contact_id'
,
'foreign'
=>
'id'
));
$this
->
hasMany
(
'Child as Children'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'adult_id'
));
}
}
\ No newline at end of file
sandbox/models/generated/BaseCar.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
abstract
class
BaseCar
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'car'
);
$this
->
hasColumn
(
'id'
,
'integer'
,
11
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
$this
->
hasColumn
(
'name'
,
'string'
,
255
);
}
public
function
setUp
()
{
$this
->
hasMany
(
'User as Users'
,
array
(
'refClass'
=>
'UserCar'
,
'local'
=>
'car_id'
,
'foreign'
=>
'user_id'
));
}
}
\ No newline at end of file
sandbox/models/generated/BaseChild.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
abstract
class
BaseChild
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'child'
);
$this
->
hasColumn
(
'id'
,
'integer'
,
11
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
$this
->
hasColumn
(
'name'
,
'string'
,
255
);
$this
->
hasColumn
(
'adult_id'
,
'integer'
,
11
);
}
public
function
setUp
()
{
$this
->
hasOne
(
'Adult'
,
array
(
'local'
=>
'adult_id'
,
'foreign'
=>
'id'
));
}
}
\ No newline at end of file
sandbox/models/generated/BaseContact.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
abstract
class
BaseContact
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'contact'
);
$this
->
hasColumn
(
'id'
,
'integer'
,
11
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
$this
->
hasColumn
(
'name'
,
'string'
,
255
);
}
public
function
setUp
()
{
$this
->
hasOne
(
'Adult'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'contact_id'
));
$this
->
hasOne
(
'User'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'contact_id'
));
}
}
\ No newline at end of file
sandbox/models/generated/BaseDog.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
abstract
class
BaseDog
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'dog'
);
$this
->
hasColumn
(
'id'
,
'integer'
,
11
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
$this
->
hasColumn
(
'name'
,
'string'
,
255
);
$this
->
hasColumn
(
'user_id'
,
'integer'
,
11
);
}
public
function
setUp
()
{
$this
->
hasOne
(
'User'
,
array
(
'local'
=>
'user_id'
,
'foreign'
=>
'id'
));
}
}
\ No newline at end of file
sandbox/models/generated/BaseEntity.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
abstract
class
BaseEntity
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'entity'
);
$this
->
hasColumn
(
'id'
,
'integer'
,
11
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
}
}
\ No newline at end of file
sandbox/models/generated/BaseGroup.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
abstract
class
BaseGroup
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'groups'
);
$this
->
hasColumn
(
'id'
,
'integer'
,
11
,
array
(
'notnull'
=>
true
,
'primary'
=>
true
,
'autoincrement'
=>
true
));
$this
->
hasColumn
(
'name'
,
'string'
,
255
);
}
public
function
setUp
()
{
$this
->
hasMany
(
'User as Users'
,
array
(
'refClass'
=>
'UserGroup'
,
'local'
=>
'group_id'
,
'foreign'
=>
'user_id'
));
}
}
\ No newline at end of file
sandbox/models/generated/BaseSelfReference.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
abstract
class
BaseSelfReference
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'self_reference'
);
$this
->
hasColumn
(
'id'
,
'integer'
,
11
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
$this
->
hasColumn
(
'name'
,
'string'
,
255
);
$this
->
hasColumn
(
'user_id1'
,
'integer'
,
11
);
$this
->
hasColumn
(
'user_id2'
,
'integer'
,
11
);
$this
->
hasColumn
(
'parent_self_reference_id'
,
'integer'
,
11
);
$this
->
hasColumn
(
'parent_self_reference_id2'
,
'integer'
,
11
);
}
public
function
setUp
()
{
$this
->
hasOne
(
'User as User1'
,
array
(
'local'
=>
'user_id1'
,
'foreign'
=>
'id'
));
$this
->
hasOne
(
'User as User2'
,
array
(
'local'
=>
'user_id2'
,
'foreign'
=>
'id'
));
$this
->
hasOne
(
'SelfReference as SelfReference1'
,
array
(
'local'
=>
'parent_self_reference_id'
,
'foreign'
=>
'id'
));
$this
->
hasOne
(
'SelfReference as SelfReference2'
,
array
(
'local'
=>
'parent_self_reference_id2'
,
'foreign'
=>
'id'
));
$this
->
hasMany
(
'SelfReference as SelfReferences1'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'parent_self_reference_id'
));
$this
->
hasMany
(
'SelfReference as SelfReferences2'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'parent_self_reference_id2'
));
}
}
\ No newline at end of file
sandbox/models/generated/BaseUser.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
abstract
class
BaseUser
extends
Entity
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'user'
);
$this
->
hasColumn
(
'id'
,
'integer'
,
11
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
));
$this
->
hasColumn
(
'username'
,
'string'
,
255
);
$this
->
hasColumn
(
'hair_color'
,
'string'
,
255
);
$this
->
hasColumn
(
'contact_id'
,
'integer'
,
11
);
$this
->
index
(
'name_x'
,
array
(
'fields'
=>
array
(
'username'
=>
array
(
'sorting'
=>
'ASC'
,
'length'
=>
'11'
,
'primary'
=>
true
,
),
),
'type'
=>
'unique'
));
}
public
function
setUp
()
{
$this
->
hasOne
(
'Contact'
,
array
(
'local'
=>
'contact_id'
,
'foreign'
=>
'id'
));
$this
->
hasMany
(
'Car as Cars'
,
array
(
'refClass'
=>
'UserCar'
,
'local'
=>
'user_id'
,
'foreign'
=>
'car_id'
));
$this
->
hasMany
(
'Group as Groups'
,
array
(
'refClass'
=>
'UserGroup'
,
'local'
=>
'user_id'
,
'foreign'
=>
'group_id'
));
$this
->
hasOne
(
'Dog'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'user_id'
));
$this
->
hasMany
(
'SelfReference as SelfReference1'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'user_id1'
));
$this
->
hasMany
(
'SelfReference as SelfReference2'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'user_id2'
));
}
}
\ No newline at end of file
sandbox/models/generated/BaseUserCar.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
abstract
class
BaseUserCar
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'user_car'
);
$this
->
hasColumn
(
'user_id'
,
'integer'
,
11
,
array
(
'primary'
=>
true
));
$this
->
hasColumn
(
'car_id'
,
'integer'
,
11
,
array
(
'primary'
=>
true
));
}
public
function
setUp
()
{
$this
->
hasOne
(
'User'
,
array
(
'local'
=>
'user_id'
,
'foreign'
=>
'id'
));
$this
->
hasOne
(
'Car'
,
array
(
'local'
=>
'car_id'
,
'foreign'
=>
'id'
));
}
}
\ No newline at end of file
sandbox/models/generated/BaseUserGroup.class.php
deleted
100644 → 0
View file @
8d2aebad
<?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
abstract
class
BaseUserGroup
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'user_group'
);
$this
->
hasColumn
(
'user_id'
,
'integer'
,
11
,
array
(
'primary'
=>
true
));
$this
->
hasColumn
(
'group_id'
,
'integer'
,
11
,
array
(
'primary'
=>
true
));
}
public
function
setUp
()
{
$this
->
hasOne
(
'User'
,
array
(
'local'
=>
'user_id'
,
'foreign'
=>
'id'
));
$this
->
hasOne
(
'Group'
,
array
(
'local'
=>
'group_id'
,
'foreign'
=>
'id'
));
}
}
\ No newline at end of file
sandbox/schema/adult.yml
deleted
100644 → 0
View file @
8d2aebad
---
Adult
:
fields
:
id
:
type
:
integer
size
:
11
primary
:
true
autoincrement
:
true
name
:
type
:
string
size
:
255
contact_id
:
type
:
integer
size
:
11
relations
:
Contact
:
foreignType
:
one
\ No newline at end of file
sandbox/schema/car.yml
deleted
100644 → 0
View file @
8d2aebad
---
Car
:
columns
:
id
:
type
:
integer
length
:
11
primary
:
true
autoincrement
:
true
name
:
type
:
string
length
:
255
relations
:
Users
:
class
:
User
refClass
:
UserCar
\ No newline at end of file
sandbox/schema/child.yml
deleted
100644 → 0
View file @
8d2aebad
---
Child
:
fields
:
id
:
type
:
integer
size
:
11
primary
:
true
autoincrement
:
true
name
:
type
:
string
size
:
255
adult_id
:
type
:
integer
size
:
11
relations
:
Adult
:
foreignAlias
:
Children
\ No newline at end of file
sandbox/schema/contact.yml
deleted
100644 → 0
View file @
8d2aebad
---
Contact
:
columns
:
id
:
type
:
integer
length
:
11
primary
:
true
autoincrement
:
true
name
:
type
:
string
length
:
255
\ No newline at end of file
sandbox/schema/dog.yml
deleted
100644 → 0
View file @
8d2aebad
---
Dog
:
columns
:
id
:
type
:
integer
length
:
11
primary
:
true
autoincrement
:
true
name
:
type
:
string
length
:
255
user_id
:
type
:
integer
length
:
11
relations
:
User
:
foreignType
:
one
\ No newline at end of file
sandbox/schema/entity.yml
deleted
100644 → 0
View file @
8d2aebad
---
Entity
:
columns
:
id
:
type
:
integer
size
:
11
primary
:
true
autoincrement
:
true
\ No newline at end of file
sandbox/schema/group.yml
deleted
100644 → 0
View file @
8d2aebad
---
Group
:
tableName
:
groups
columns
:
id
:
notnull
:
true
primary
:
true
autoincrement
:
true
type
:
integer
length
:
11
name
:
id
name
:
type
:
string
length
:
255
relations
:
Users
:
class
:
User
refClass
:
UserGroup
sandbox/schema/self_reference.yml
deleted
100644 → 0
View file @
8d2aebad
---
SelfReference
:
fields
:
id
:
type
:
integer
length
:
11
primary
:
true
autoincrement
:
true
name
:
type
:
string
length
:
255
user_id1
:
type
:
integer
length
:
11
user_id2
:
type
:
integer
length
:
11
parent_self_reference_id
:
type
:
integer
length
:
11
parent_self_reference_id2
:
type
:
integer
length
:
11
relations
:
User1
:
class
:
User
local
:
user_id1
foreignAlias
:
SelfReference1
User2
:
class
:
User
local
:
user_id2
foreignAlias
:
SelfReference2
SelfReference1
:
class
:
SelfReference
local
:
parent_self_reference_id
foreignAlias
:
SelfReferences1
SelfReference2
:
class
:
SelfReference
local
:
parent_self_reference_id2
foreignAlias
:
SelfReferences2
sandbox/schema/user.yml
deleted
100644 → 0
View file @
8d2aebad
---
User
:
inheritance
:
extends
:
Entity
fields
:
id
:
type
:
integer
size
:
11
primary
:
true
autoincrement
:
true
username
:
type
:
string
length
:
255
hair_color
:
type
:
string
length
:
255
contact_id
:
type
:
integer
length
:
11
relations
:
Contact
:
local
:
contact_id
foreign
:
id
foreignType
:
one
Cars
:
class
:
Car
refClass
:
UserCar
Groups
:
class
:
Group
refClass
:
UserGroup
indexes
:
name_x
:
columns
:
username
:
sorting
:
ASC
length
:
11
primary
:
true
type
:
unique
\ No newline at end of file
sandbox/schema/user_car.yml
deleted
100644 → 0
View file @
8d2aebad
---
UserCar
:
columns
:
user_id
:
type
:
integer
length
:
11
primary
:
true
car_id
:
type
:
integer
length
:
11
primary
:
true
relations
:
User
:
-
Car
:
-
\ No newline at end of file
sandbox/schema/user_group.yml
deleted
100644 → 0
View file @
8d2aebad
---
UserGroup
:
columns
:
user_id
:
type
:
integer
length
:
11
primary
:
true
group_id
:
type
:
integer
length
:
11
primary
:
true
relations
:
User
:
-
Group
:
-
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