CLI configured for development purposes
This commit is contained in:
parent
88b0813536
commit
54476882c7
@ -1,36 +1,63 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once '../../lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
|
require_once __DIR__ . '/../../lib/Doctrine/Common/ClassLoader.php';
|
||||||
|
|
||||||
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\ORM', realpath(__DIR__ . '/../../lib'));
|
|
||||||
$classLoader->register();
|
|
||||||
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\DBAL', realpath(__DIR__ . '/../../lib/vendor/doctrine-dbal/lib'));
|
|
||||||
$classLoader->register();
|
|
||||||
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\Common', realpath(__DIR__ . '/../../lib/vendor/doctrine-common/lib'));
|
|
||||||
$classLoader->register();
|
|
||||||
$classLoader = new \Doctrine\Common\ClassLoader('Symfony', realpath(__DIR__ . '/../../lib/vendor'));
|
|
||||||
$classLoader->register();
|
|
||||||
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
|
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
|
||||||
$classLoader->register();
|
$classLoader->register();
|
||||||
|
|
||||||
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
|
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
|
||||||
$classLoader->register();
|
$classLoader->register();
|
||||||
|
|
||||||
|
require_once '/var/workspaces/nexxone/library/Zend/Acl/Resource/Interface.php';
|
||||||
|
require_once '/var/workspaces/nexxone/library/Zend/Acl/Role/Interface.php';
|
||||||
|
|
||||||
|
$classLoader = new \Doctrine\Common\ClassLoader('Core\Model', '/var/workspaces/nexxone/application/modules/core/models/');
|
||||||
|
$classLoader->register();
|
||||||
|
|
||||||
|
$classLoader = new \Doctrine\Common\ClassLoader('Content\Model', '/var/workspaces/nexxone/application/modules/content/models/');
|
||||||
|
$classLoader->register();
|
||||||
|
|
||||||
|
$classLoader = new \Doctrine\Common\ClassLoader('User\Model', '/var/workspaces/nexxone/application/modules/user/models/');
|
||||||
|
$classLoader->register();
|
||||||
|
|
||||||
|
|
||||||
$config = new \Doctrine\ORM\Configuration();
|
$config = new \Doctrine\ORM\Configuration();
|
||||||
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
|
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
|
||||||
$driverImpl = $config->newDefaultAnnotationDriver(array(__DIR__."/Entities"));
|
|
||||||
$config->setMetadataDriverImpl($driverImpl);
|
|
||||||
|
|
||||||
$config->setProxyDir(__DIR__ . '/Proxies');
|
$config->setProxyDir(__DIR__ . '/Proxies');
|
||||||
$config->setProxyNamespace('Proxies');
|
|
||||||
|
|
||||||
$connectionOptions = array(
|
$config->setProxyNamespace('LivandoCMSProxies');
|
||||||
'driver' => 'pdo_sqlite',
|
$driver = new Doctrine\ORM\Mapping\Driver\YamlDriver(
|
||||||
'path' => 'database.sqlite'
|
array(
|
||||||
|
'/var/workspaces/nexxone/application/modules/core/config/schema',
|
||||||
|
'/var/workspaces/nexxone/application/modules/content/config/schema',
|
||||||
|
'/var/workspaces/nexxone/application/modules/user/config/schema',
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
#$driver = new Doctrine\ORM\Mapping\Driver\YamlDriver(array('./yaml/'), YamlDriver::PRELOAD);
|
||||||
|
$config->setMetadataDriverImpl($driver);
|
||||||
|
|
||||||
$em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);
|
$conn = new \Doctrine\DBAL\Connection(
|
||||||
|
array (
|
||||||
|
'pdo' => new PDO(
|
||||||
|
"mysql:host=localhost;dbname=nexxone;unix_socket=/var/run/mysqld/mysqld.sock",
|
||||||
|
'root',
|
||||||
|
'mysql5023'
|
||||||
|
)
|
||||||
|
),
|
||||||
|
new Doctrine\DBAL\Driver\PDOMySql\Driver(),
|
||||||
|
$config
|
||||||
|
);
|
||||||
|
|
||||||
|
//$connectionOptions = array(
|
||||||
|
// 'driver' => 'pdo_sqlite',
|
||||||
|
// 'path' => 'database.sqlite'
|
||||||
|
//);
|
||||||
|
|
||||||
|
// These are required named variables (names can't change!)
|
||||||
|
$em = \Doctrine\ORM\EntityManager::create($conn, $config);
|
||||||
|
|
||||||
$helpers = array(
|
$helpers = array(
|
||||||
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
|
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
|
||||||
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
|
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user