-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdoctrine
executable file
·35 lines (24 loc) · 1.23 KB
/
doctrine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env php
<?php
define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application'));
define('LIBRARY_PATH', realpath(dirname(__FILE__) . '/library'));
set_include_path(LIBRARY_PATH . PATH_SEPARATOR . get_include_path());
require_once 'Doctrine.php';
spl_autoload_register(array('Doctrine', 'autoload'));
spl_autoload_register(array('Doctrine_Core', 'modelsAutoload'));
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$config = new Zend_Config_Ini('configs/application.ini', 'development');
$manager = Doctrine_Manager::getInstance();
Doctrine_Manager::connection($config->resources->doctrine->connections->default->dsn, 'doctrine');
$manager->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE);
$cli_config = array(
'models_path' => APPLICATION_PATH . '/models',
'sql_path' => APPLICATION_PATH . '/../database/sql',
'yaml_schema_path' => APPLICATION_PATH . '/../database/schema',
'migrations_path' => APPLICATION_PATH . '/../database/migrations',
'data_fixtures_path' => APPLICATION_PATH . '/../database/fixtures'
);
Doctrine::loadModels($cli_config['models_path']);
$cli = new Doctrine_Cli($cli_config);
$cli->run($_SERVER['argv']);