cli-config.php 1006 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. $config = new \Doctrine\ORM\Configuration();
  3. $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
  4. use Doctrine\Common\Annotations\AnnotationReader;
  5. use Doctrine\Common\Annotations\AnnotationRegistry;
  6. $sysPath = __DIR__."/";
  7. AnnotationRegistry::registerFile($sysPath."vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php");
  8. $reader = new AnnotationReader();
  9. $driverImpl = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, array($sysPath."tests/doctrine_console/mapping"));
  10. $config->setMetadataDriverImpl($driverImpl);
  11. $config->setProxyDir(__DIR__ . '/Proxies');
  12. $config->setProxyNamespace('Proxies');
  13. $defaultConnection = array(
  14. 'driver' => 'pdo_mysql',
  15. 'dbname' => 'chamilo',
  16. 'user' => 'root',
  17. 'password' => 'root',
  18. 'host' => 'localhost',
  19. );
  20. $em = \Doctrine\ORM\EntityManager::create($defaultConnection, $config);
  21. use Doctrine\ORM\Tools\Console\ConsoleRunner;
  22. return ConsoleRunner::createHelperSet($em);