Created
September 23, 2011 17:14
-
-
Save hidenorigoto/1237920 to your computer and use it in GitHub Desktop.
bootstrap for Doctrine2 (2.1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . '/vendor/doctrine/lib/Doctrine/ORM/Tools/Setup.php'; | |
$lib = __DIR__ . '/vendor/doctrine'; | |
Doctrine\ORM\Tools\Setup::registerAutoloadGit($lib); | |
$config = Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration(array(__DIR__ . '/Entity/Project/Entity'), true); | |
$loader = new Doctrine\Common\ClassLoader("Project\Entity", __DIR__ . '/Entity'); | |
$loader->register(); | |
$connectionOptions = array( | |
'driver' => 'pdo_mysql', | |
'host' => 'localhost', | |
'dbname' => '******', | |
'user' => '******', | |
'password' => '******', | |
'charset' => 'UTF8', | |
); | |
$em = Doctrine\ORM\EntityManager::create($connectionOptions, $config); | |
//$em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); | |
//$em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('blob', 'text'); | |
//$em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('longblob', 'text'); | |
$helpers = array( | |
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()), | |
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment