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
34af8e3a
Commit
34af8e3a
authored
Oct 15, 2007
by
Jonathan.Wage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved cli to sandbox folder. Fixes to importing schema and generating sql.
parent
ea368a36
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
181 additions
and
273 deletions
+181
-273
Doctrine.php
lib/Doctrine.php
+3
-2
Task.php
lib/Doctrine/Cli/Task.php
+6
-2
GenerateSql.php
lib/Doctrine/Cli/Task/GenerateSql.php
+9
-1
Config.php
lib/Doctrine/Config.php
+0
-100
Import.php
lib/Doctrine/Import.php
+1
-0
Schema.php
lib/Doctrine/Import/Schema.php
+60
-2
cli.php
lib/cli.php
+0
-5
cli
sandbox/cli
+0
-0
cli.php
sandbox/cli.php
+13
-0
cli_compiler.php
sandbox/cli_compiler.php
+77
-141
config.php.dist
sandbox/config.php.dist
+12
-20
No files found.
lib/Doctrine.php
View file @
34af8e3a
...
...
@@ -558,6 +558,7 @@ final class Doctrine
public
static
function
generateModelsFromYaml
(
$yamlPath
,
$directory
)
{
$import
=
new
Doctrine_Import_Schema
();
$import
->
generateBaseClasses
(
true
);
return
$import
->
importSchema
(
$yamlPath
,
'yml'
,
$directory
);
}
...
...
@@ -754,8 +755,8 @@ final class Doctrine
$path
=
$directory
.
DIRECTORY_SEPARATOR
.
$fileName
;
$code
=
'<?php'
.
PHP_EOL
;
$code
.=
"// Automatically generated by
Doctrine
\n
"
;
$code
.=
"class "
.
$className
.
" extends Doctrine_Migration
\n
"
;
$code
.=
"// Automatically generated by
the Doctrine ORM Framework
\n
"
;
$code
.=
"class "
.
Doctrine
::
classify
(
$className
)
.
" extends Doctrine_Migration
\n
"
;
$code
.=
"{\n"
;
$code
.=
"
\t
public function up()
\n\t
{ }
\n\n
"
;
$code
.=
"
\t
public function down()
\n\t
{ }
\n
"
;
...
...
lib/Doctrine/Cli/Task.php
View file @
34af8e3a
...
...
@@ -55,9 +55,13 @@ abstract class Doctrine_Cli_Task
return
true
;
}
public
function
getArgument
(
$name
)
public
function
getArgument
(
$name
,
$default
=
null
)
{
return
$this
->
arguments
[
$name
];
if
(
isset
(
$this
->
arguments
[
$name
]))
{
return
$this
->
arguments
[
$name
];
}
else
if
(
$default
)
{
return
$default
;
}
}
public
function
getArguments
()
...
...
lib/Doctrine/Cli/Task/GenerateSql.php
View file @
34af8e3a
...
...
@@ -41,6 +41,14 @@ class Doctrine_Cli_Task_GenerateSql extends Doctrine_Cli_Task
{
$sql
=
Doctrine
::
generateSqlFromModels
(
$this
->
getArgument
(
'models_path'
));
file_put_contents
(
$this
->
getArgument
(
'sql_path'
),
implode
(
"
\n
"
,
$sql
));
if
(
is_dir
(
$this
->
getArgument
(
'sql_path'
)))
{
$path
=
$this
->
getArgument
(
'sql_path'
)
.
DIRECTORY_SEPARATOR
.
'schema.sql'
;
}
else
if
(
is_file
(
$this
->
getArgument
(
'sql_path'
)))
{
$path
=
$this
->
getArgument
(
'sql_path'
);
}
else
{
throw
new
Doctrine_Cli_Exception
(
'Invalid sql path.'
);
}
file_put_contents
(
$path
,
implode
(
"
\n
"
,
$sql
));
}
}
\ No newline at end of file
lib/Doctrine/Config.php
deleted
100644 → 0
View file @
ea368a36
<?php
/*
* $Id: Config.php 2753 2007-10-07 20:58:08Z 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_Config
*
* Class used to simplify the setup and configuration of a doctrine implementation.
*
* @package Doctrine
* @subpackage Config
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision: 2753 $
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Jonathan H. Wage <jwage@mac.com>
*/
class
Doctrine_Config
{
protected
$connections
=
array
();
protected
$cliConfig
=
array
();
/**
* addConnection
*
* @param string $adapter
* @param string $name
* @return void
*/
public
function
addConnection
(
$adapter
,
$name
=
null
)
{
$connections
[]
=
Doctrine_Manager
::
getInstance
()
->
openConnection
(
$adapter
,
$name
);
}
/**
* bindComponent
*
* @param string $modelName
* @param string $connectionName
* @return void
*/
public
function
bindComponent
(
$modelName
,
$connectionName
)
{
return
Doctrine_Manager
::
getInstance
()
->
bindComponent
(
$modelName
,
$connectionName
);
}
/**
* setAttribute
*
* @param string $key
* @param string $value
* @return void
*/
public
function
setAttribute
(
$key
,
$value
)
{
foreach
(
$this
->
connections
as
$connection
)
{
$connection
->
setAttribute
(
$key
,
$value
);
}
}
/**
* addCliConfig
*
* @param string $key
* @param string $value
* @return void
*/
public
function
addCliConfig
(
$key
,
$value
)
{
$this
->
cliConfig
[
$key
]
=
$value
;
}
/**
* getCliConfig
*
* @return void
*/
public
function
getCliConfig
()
{
return
$this
->
cliConfig
;
}
}
\ No newline at end of file
lib/Doctrine/Import.php
View file @
34af8e3a
...
...
@@ -189,6 +189,7 @@ class Doctrine_Import extends Doctrine_Connection_Module
foreach
(
$connections
as
$connection
)
{
$builder
=
new
Doctrine_Import_Builder
();
$builder
->
generateBaseClasses
(
true
);
$builder
->
setTargetPath
(
$directory
);
$classes
=
array
();
...
...
lib/Doctrine/Import/Schema.php
View file @
34af8e3a
...
...
@@ -43,6 +43,12 @@ class Doctrine_Import_Schema
public
$indexes
=
array
();
public
$generateBaseClasses
=
false
;
/**
* generateBaseClasses
*
* @param string $bool
* @return void
*/
public
function
generateBaseClasses
(
$bool
=
null
)
{
if
(
$bool
!==
null
)
{
...
...
@@ -51,17 +57,39 @@ class Doctrine_Import_Schema
return
$this
->
generateBaseClasses
;
}
/**
* buildSchema
*
* @param string $schema
* @param string $format
* @return void
*/
public
function
buildSchema
(
$schema
,
$format
)
{
$array
=
array
();
foreach
((
array
)
$schema
AS
$s
)
{
$array
=
array_merge
(
$array
,
$this
->
parseSchema
(
$s
,
$format
));
if
(
is_file
(
$s
))
{
$array
=
array_merge
(
$array
,
$this
->
parseSchema
(
$s
,
$format
));
}
else
if
(
is_dir
(
$s
))
{
$it
=
new
RecursiveIteratorIterator
(
new
RecursiveDirectoryIterator
(
$s
),
RecursiveIteratorIterator
::
LEAVES_ONLY
);
foreach
(
$it
as
$file
)
{
$e
=
explode
(
'.'
,
$file
->
getFileName
());
if
(
end
(
$e
)
===
$format
)
{
$array
=
array_merge
(
$array
,
$this
->
parseSchema
(
$file
->
getPathName
(),
$format
));
}
}
}
}
$this
->
buildRelationships
(
$array
);
return
array
(
'schema'
=>
$array
,
'relations'
=>
$this
->
relations
,
'indexes'
=>
$this
->
indexes
);
}
/**
* importSchema
*
...
...
@@ -96,6 +124,13 @@ class Doctrine_Import_Schema
}
}
/**
* getOptions
*
* @param string $properties
* @param string $directory
* @return void
*/
public
function
getOptions
(
$properties
,
$directory
)
{
$options
=
array
();
...
...
@@ -110,11 +145,23 @@ class Doctrine_Import_Schema
return
$options
;
}
/**
* getColumns
*
* @param string $properties
* @return void
*/
public
function
getColumns
(
$properties
)
{
return
isset
(
$properties
[
'columns'
])
?
$properties
[
'columns'
]
:
array
();
}
/**
* getRelations
*
* @param string $properties
* @return void
*/
public
function
getRelations
(
$properties
)
{
return
isset
(
$this
->
relations
[
$properties
[
'className'
]])
?
$this
->
relations
[
$properties
[
'className'
]]
:
array
();
...
...
@@ -181,6 +228,12 @@ class Doctrine_Import_Schema
return
$build
;
}
/**
* buildRelationships
*
* @param string $array
* @return void
*/
public
function
buildRelationships
(
&
$array
)
{
foreach
(
$array
as
$name
=>
$properties
)
{
...
...
@@ -225,6 +278,11 @@ class Doctrine_Import_Schema
$this
->
fixRelationships
();
}
/**
* fixRelationships
*
* @return void
*/
public
function
fixRelationships
()
{
// define both sides of the relationship
...
...
lib/cli.php
deleted
100644 → 0
View file @
ea368a36
<?php
require_once
(
'config.php'
);
$cli
=
new
Doctrine_Cli
(
$config
->
getCliConfig
());
$cli
->
run
(
$_SERVER
[
'argv'
]);
\ No newline at end of file
lib
/cli
→
sandbox
/cli
View file @
34af8e3a
File moved
sandbox/cli.php
0 → 100644
View file @
34af8e3a
<?php
require_once
(
'config.php'
);
// Configure Doctrine Cli
// Normally these are arguments to the cli tasks but if they are set here the arguments will be auto-filled
$config
=
array
(
'data_fixtures_path'
=>
DATA_FIXTURES_PATH
,
'models_path'
=>
MODELS_PATH
,
'migrations_path'
=>
MIGRATIONS_PATH
,
'sql_path'
=>
SQL_PATH
,
'yaml_schema_path'
=>
YAML_SCHEMA_PATH
);
$cli
=
new
Doctrine_Cli
(
$config
);
$cli
->
run
(
$_SERVER
[
'argv'
]);
\ No newline at end of file
lib
/cli_compiler.php
→
sandbox
/cli_compiler.php
View file @
34af8e3a
#!/usr/bin/env php
<?php
chdir(dirname(__FILE__));
?>
#!/usr/bin/php
Welcome to the interactive Doctrine Compiler 0.0.1 (Beta).
WARNING: You're on your own - this script modifies your
...
...
@@ -28,6 +26,21 @@ While the program is running:
exit
;
}
if
(
$argc
>
1
)
{
$doctrinePath
=
$argv
[
1
];
}
$drivers
=
array
(
'Db2'
,
'Firebird'
,
'Informix'
,
'Mssql'
,
'Mysql'
,
'Oracle'
,
'Pgsql'
,
'Sqlite'
);
function
addIncludePath
(
$path
)
{
set_include_path
(
$path
.
PATH_SEPARATOR
.
get_include_path
()
...
...
@@ -97,30 +110,20 @@ function ask(
}
}
// Enable error reporting
if
((
$answer
=
ask
(
"Would you like to turn on error reporting?"
,
'n'
))
==
'y'
)
{
error_reporting
(
E_ALL
);
$showErrors
=
true
;
}
else
{
error_reporting
(
0
);
$showErrors
=
false
;
}
autoQuit
(
$answer
);
// Process library path command line argument
if
(
$argc
>
1
)
{
$doctrinePath
=
$argv
[
1
];
}
else
{
$doctrinePath
=
dirname
(
__FILE__
);
}
// Get Doctrine's library path
$usablePath
=
false
;
while
(
!
$usablePath
)
{
if
(
!
isset
(
$doctrinePath
))
{
$doctrinePath
=
dirname
(
__FILE__
);
}
$path
=
ask
(
"Please enter the path to Doctrine's lib directory:"
,
$doctrinePath
,
array
(
$doctrinePath
),
false
);
autoQuit
(
$path
);
try
{
...
...
@@ -136,58 +139,10 @@ while (!$usablePath) {
}
}
// Process target filename command line argument
if
(
$argc
>
2
)
{
$targetFile
=
$argv
[
2
];
}
else
{
$targetFile
=
$path
.
DIRECTORY_SEPARATOR
.
'Doctrine.compiled.php'
;
}
clearstatcache
();
$usableFilename
=
false
;
while
(
!
$usableFilename
)
{
$target
=
ask
(
"Please enter the target filename for the 'compiled' Doctrine file that will be created:"
,
$targetFile
,
array
(
$targetFile
),
false
);
autoQuit
(
$target
);
if
(
file_exists
(
$target
))
{
if
(
is_writable
(
$target
)
&&
(
!
is_dir
(
$target
)))
{
$usableFilename
=
true
;
}
else
{
$msg
=
"The target filename '
$target
' cannot be used (it is not writable, or it is a directory)."
;
}
}
else
{
if
(
is_writable
(
dirname
(
$target
)))
{
$usableFilename
=
true
;
}
else
{
$msg
=
"The directory in which the target file will be created is not writable."
;
}
}
if
(
!
$usableFilename
)
{
showMessage
(
$msg
);
if
((
$answer
=
ask
(
"Would you like to specify a different target filename?"
))
!=
'y'
)
{
quit
();
}
}
}
// Define the default drivers - unfortunately, this is hard-coded for now
$drivers
=
array
(
'Db2'
,
'Firebird'
,
'Informix'
,
'Mssql'
,
'Mysql'
,
'Oracle'
,
'Pgsql'
,
'Sqlite'
);
$includeDrivers
=
array
();
$excludeDrivers
=
array
();
// Determine driver support
foreach
(
$drivers
as
$driver
)
{
if
((
$answer
=
ask
(
"Would you like to enable support for
$driver
?"
))
==
'y'
)
{
$includeDrivers
[]
=
$driver
;
...
...
@@ -198,22 +153,19 @@ foreach ($drivers as $driver) {
}
// Verify driver support
if
(
!
count
(
$includeDrivers
))
{
showMessage
(
"You have not selected any drivers.
Usu
ally this is not a good idea, unless you know what you're doing."
);
showMessage
(
"You have not selected any drivers.
Norm
ally this is not a good idea, unless you know what you're doing."
);
if
((
$answer
=
ask
(
"Are you sure you want to compile without any drivers?"
))
!=
'y'
)
{
quit
();
}
autoQuit
(
$answer
);
}
// Try to prevent errors related to memory allocation
$requiredMemory
=
'20M'
;
showMessage
(
"Trying to set the PHP memory limit to
$requiredMemory
..."
);
ini_set
(
'memory_limit'
,
$requiredMemory
);
if
(
ini_get
(
'memory_limit'
)
!=
$requiredMemory
)
{
showMessage
(
"WARNING: The program could not set the PHP memory limit to
$requiredMemory
. The compilation might fail."
);
// 'Compile' Doctrine...
showMessage
(
"Trying to set the PHP memory limit to 18MB..."
);
ini_set
(
'memory_limit'
,
'18M'
);
if
(
ini_get
(
'memory_limit'
)
!=
'18M'
)
{
showMessage
(
"WARNING: The program could not set the PHP memory limit to 18MB. The compilation might fail."
);
if
((
$answer
=
ask
(
"Do you still want to continue?"
))
!=
'y'
)
{
quit
;
}
...
...
@@ -221,96 +173,80 @@ if (ini_get('memory_limit') != $requiredMemory) {
showMessage
(
"PHP memory limit adjusted successfully."
);
}
// Build / 'Compile' Doctrine...
$target
=
'./Doctrine.compiled.php'
;
try
{
$it
=
new
RecursiveIteratorIterator
(
new
RecursiveDirectoryIterator
(
$path
),
RecursiveIteratorIterator
::
LEAVES_ONLY
);
$it
=
new
RecursiveIteratorIterator
(
new
RecursiveDirectoryIterator
(
$path
),
RecursiveIteratorIterator
::
LEAVES_ONLY
);
foreach
(
$it
as
$file
)
{
$e
=
explode
(
'.'
,
$file
->
getFileName
());
foreach
(
$it
as
$file
)
{
$e
=
explode
(
'.'
,
$file
->
getFileName
());
// We don't want to require versioning files, or cli files
if
(
end
(
$e
)
===
'php'
&&
strpos
(
$file
->
getFileName
(),
'.inc'
)
===
false
&&
strpos
(
$file
->
getFileName
(),
'cli'
)
!==
0
)
{
require_once
$file
->
getPathName
();
}
// we don't want to require versioning files
if
(
end
(
$e
)
===
'php'
&&
strpos
(
$file
->
getFileName
(),
'.inc'
)
===
false
)
{
require_once
$file
->
getPathName
();
}
}
$classes
=
array_merge
(
get_declared_classes
(),
get_declared_interfaces
());
$ret
=
array
();
$classes
=
array_merge
(
get_declared_classes
(),
get_declared_interfaces
());
foreach
(
$classes
as
$class
)
{
$e
=
explode
(
'_'
,
$class
);
$ret
=
array
();
if
(
$e
[
0
]
!==
'Doctrine'
)
{
continue
;
}
foreach
(
$classes
as
$class
)
{
$e
=
explode
(
'_'
,
$class
);
// Skip excluded drivers
if
(
$e
[
0
]
!==
'Doctrine'
)
{
continue
;
}
$skipClass
=
false
;
foreach
(
$excludeDrivers
as
$excludeDriver
)
{
if
(
in_array
(
$excludeDriver
,
$e
)
)
{
$skipClass
=
true
;
break
;
}
// Skip excluded drivers
$skipClass
=
false
;
foreach
(
$excludeDrivers
as
$excludeDriver
)
{
if
(
in_array
(
$excludeDriver
,
$e
))
{
$skipClass
=
true
;
break
;
}
if
(
$skipClass
)
{
echo
"
\n
Excluding ->
$class
"
;
continue
;
}
$refl
=
new
ReflectionClass
(
$class
);
$file
=
$refl
->
getFileName
();
echo
"
\n
Including ->
$file
"
;
}
if
(
$skipClass
)
{
echo
"
\n
Excluding ->
$class
"
;
continue
;
}
$lines
=
file
(
$file
);
$refl
=
new
ReflectionClass
(
$class
);
$file
=
$refl
->
getFileName
();
$start
=
$refl
->
getStartLine
()
-
1
;
$end
=
$refl
->
getEndLine
();
echo
"
\n
Including ->
$file
"
;
$ret
=
array_merge
(
$ret
,
array_slice
(
$lines
,
$start
,
(
$end
-
$start
)));
}
$lines
=
file
(
$file
);
// first write the 'compiled' data to a text file, so
// that we can use php_strip_whitespace (which only works on files)
$start
=
$refl
->
getStartLine
()
-
1
;
$end
=
$refl
->
getEndLine
();
$fp
=
@
fopen
(
$target
,
'w'
);
if
(
$fp
===
false
)
{
throw
new
Exception
(
"Couldn't write compiled data. Failed to open
$target
"
);
}
fwrite
(
$fp
,
"<?php "
.
implode
(
''
,
$ret
));
fclose
(
$fp
);
$ret
=
array_merge
(
$ret
,
array_slice
(
$lines
,
$start
,
(
$end
-
$start
)));
}
$stripped
=
php_strip_whitespace
(
$target
);
$fp
=
@
fopen
(
$target
,
'w'
);
if
(
$fp
===
false
)
{
throw
new
Exception
(
"Couldn't write compiled data. Failed to open
$file
"
);
}
fwrite
(
$fp
,
$stripped
);
fclose
(
$fp
);
if
(
$target
==
null
)
{
$target
=
$path
.
DIRECTORY_SEPARATOR
.
'Doctrine.compiled.php'
;
}
}
catch
(
Exception
$e
)
{
// first write the 'compiled' data to a text file, so
// that we can use php_strip_whitespace (which only works on files)
$fp
=
@
fopen
(
$target
,
'w'
);
if
(
!
$showErrors
)
{
if
((
$answer
=
ask
(
"Sorry, an error occurred during the build. Would you like to see the error?"
))
==
'y'
)
{
showMessage
(
"
\n
$e
"
);
}
else
{
quit
();
}
}
showMessage
(
"
\n
Build Aborted."
);
exit
;
if
(
$fp
===
false
)
{
throw
new
Exception
(
"Couldn't write compiled data. Failed to open
$target
"
);
}
fwrite
(
$fp
,
"<?php "
.
implode
(
''
,
$ret
));
fclose
(
$fp
);
$stripped
=
php_strip_whitespace
(
$target
);
$fp
=
@
fopen
(
$target
,
'w'
);
if
(
$fp
===
false
)
{
throw
new
Exception
(
"Couldn't write compiled data. Failed to open
$file
"
);
}
fwrite
(
$fp
,
$stripped
);
fclose
(
$fp
);
// Say bye...
showMessage
(
"
\n
Compilation Finished."
);
showMessage
(
"Thank you for using the interactive Doctrine Compiler. Have fun following the Doctrine :)
\n
"
);
...
...
lib
/config.php.dist
→
sandbox
/config.php.dist
View file @
34af8e3a
<?php
/*
* $Id:
C
onfig.php 2753 2007-10-07 20:58:08Z Jonathan.Wage $
* $Id:
c
onfig.php 2753 2007-10-07 20:58:08Z Jonathan.Wage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
...
...
@@ -23,8 +23,6 @@
* Doctrine Configuration File
*
* This is a sample implementation of Doctrine
* You can use the Doctrine_Config interface below to setup the basics.
* Or if you prefer you can setup your Doctrine configuration manually.
*
* @package Doctrine
* @subpackage Config
...
...
@@ -36,23 +34,17 @@
* @author Jonathan H. Wage <jwage@mac.com>
*/
// Load Doctrine
require_once
(
'Doctrine.php'
);
spl_autoload_register
(
array
(
'Doctrine'
,
'autoload'
));
// New Doctrine Config
$config
=
new
Doctrine_Config
();
define
(
'SANDBOX_PATH'
,
dirname
(
__FILE__
));
define
(
'DOCTRINE_PATH'
,
dirname
(
SANDBOX_PATH
)
.
DIRECTORY_SEPARATOR
.
'lib'
);
define
(
'DATA_FIXTURES_PATH'
,
SANDBOX_PATH
.
DIRECTORY_SEPARATOR
.
'data'
.
DIRECTORY_SEPARATOR
.
'fixtures'
);
define
(
'MODELS_PATH'
,
SANDBOX_PATH
.
DIRECTORY_SEPARATOR
.
'models'
);
define
(
'MIGRATIONS_PATH'
,
SANDBOX_PATH
.
DIRECTORY_SEPARATOR
.
'models'
);
define
(
'SQL_PATH'
,
SANDBOX_PATH
.
DIRECTORY_SEPARATOR
.
'data'
.
DIRECTORY_SEPARATOR
.
'sql'
);
define
(
'YAML_SCHEMA_PATH'
,
SANDBOX_PATH
.
DIRECTORY_SEPARATOR
.
'schema'
);
define
(
'DSN'
,
'sqlite:/'
.
SANDBOX_PATH
.
DIRECTORY_SEPARATOR
.
'sandbox.db'
);
// Setup Connections
//$config->addConnection('mysql://user:pass@localhost/db_name', 'connection_1');
//$config->addConnection(new PDO('dsn', 'username', 'password'), 'connection_2);
require_once
(
DOCTRINE_PATH
.
DIRECTORY_SEPARATOR
.
'Doctrine.php'
);
// Bind components/models to connections
//$config->bindComponent('User', 'connection_1');
spl_autoload_register
(
array
(
'Doctrine'
,
'autoload'
));
// Configure Doctrine Cli
// Normally these are arguments to the cli tasks but if they are set here the arguments will be auto-filled
//$config->addCliConfig('data_fixtures_path', '/path/to/your/data_fixtures');
//$config->addCliConfig('models_path', '/path/to/your/models');
//$config->addCliConfig('migrations_path', '/peth/to/your/migration/classes');
//$config->addCliConfig('sql_path', '/path/to/your/exported/sql');
\ No newline at end of file
Doctrine_Manager
::
connection
(
DSN
,
'sandbox'
);
\ 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