protected function setUp()
 {
     $config = new Configuration();
     //$config->setHydratorDir(sys_get_temp_dir());
     //$config->setHydratorNamespace('Hydrators');
     $config->setProxyDir(sys_get_temp_dir());
     $config->setProxyNamespace('Proxies');
     $locatorXml = new SymfonyFileLocator(array(__DIR__ . '/../../../../../lib/Vespolina/Product/Mapping' => 'Vespolina\\Entity\\Product', __DIR__ . '/../../../../../vendor/vespolina/pricing/lib/Vespolina/Pricing/Mapping' => 'Vespolina\\Entity\\Pricing', __DIR__ . '/../../../../../vendor/vespolina/taxonomy/lib/Vespolina/Taxonomy/Mapping' => 'Vespolina\\Entity\\Taxonomy'), '.orm.xml');
     $drivers = new MappingDriverChain();
     $xmlDriver = new XmlDriver($locatorXml);
     $config->setMetadataDriverImpl($xmlDriver);
     $config->setMetadataCacheImpl(new ArrayCache());
     $config->setAutoGenerateProxyClasses(true);
     $eventManager = new EventManager();
     $treeListener = new TreeListener();
     $eventManager->addEventSubscriber($treeListener);
     $em = EntityManager::create(array('driver' => 'pdo_sqlite', 'path' => 'database.sqlite'), $config, $eventManager);
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);
     $classes = array($em->getClassMetadata('Vespolina\\Entity\\Product\\Product'), $em->getClassMetadata('Vespolina\\Entity\\Taxonomy\\TaxonomyNode'));
     try {
         $schemaTool->dropSchema(array());
         $schemaTool->createSchema($classes);
     } catch (\Exception $e) {
     }
     $this->productGateway = new ProductDoctrineORMGateway($em, 'Vespolina\\Entity\\Product\\Product');
     $this->taxonomyGateway = new TaxonomyDoctrineORMGateway($em, 'Vespolina\\Entity\\Taxonomy\\TaxonomyNode');
     parent::setUp();
 }
 /**
  * @see http://jamesmcfadden.co.uk/database-unit-testing-with-doctrine-2-and-phpunit/
  */
 public function getConnection()
 {
     // 別途 Application を生成しているような箇所があると動作しないので注意
     $app = EccubeTestCase::createApplication();
     // Get an instance of your entity manager
     $entityManager = $app['orm.em'];
     // Retrieve PDO instance
     $pdo = $entityManager->getConnection()->getWrappedConnection();
     // Clear Doctrine to be safe
     $entityManager->clear();
     // Schema Tool to process our entities
     $tool = new \Doctrine\ORM\Tools\SchemaTool($entityManager);
     $classes = $entityManager->getMetaDataFactory()->getAllMetaData();
     // Drop all classes and re-build them for each test case
     $tool->dropSchema($classes);
     $tool->createSchema($classes);
     $config = new Configuration($app['db']);
     $config->setMigrationsNamespace('DoctrineMigrations');
     $migrationDir = __DIR__ . '/../../../src/Eccube/Resource/doctrine/migration';
     $config->setMigrationsDirectory($migrationDir);
     $config->registerMigrationsFromDirectory($migrationDir);
     $migration = new Migration($config);
     $migration->migrate(null, false);
     self::$app = $app;
     // Pass to PHPUnit
     return $this->createDefaultDBConnection($pdo, 'db_name');
 }
Beispiel #3
0
 public static function CreateSchema()
 {
     $metadata = self::$entityManager->getMetadataFactory()->getAllMetadata();
     $schemaTool = new Doctrine\ORM\Tools\SchemaTool(self::$entityManager);
     $schemaTool->createSchema($metadata);
     return;
 }
 public function initDb()
 {
     $configArray = $this->sm->get('config');
     $db_name = $configArray['doctrine']['connection']['orm_default'];
     \Zend\Debug\Debug::dump($db_name);
     exit;
     $DEBUG = true;
     // Retrieve the Doctrine 2 entity manager
     $em = $this->sm->get('doctrine.entitymanager.orm_default');
     // Instantiate the schema tool
     $tool = new \Doctrine\ORM\Tools\SchemaTool($em);
     // Retrieve all of the mapping metadata
     $classes = $em->getMetadataFactory()->getAllMetadata();
     if ($DEBUG) {
         print "dropping schema\n";
     }
     // Delete the existing test database schema
     $tool->dropSchema($classes);
     if ($DEBUG) {
         print "creating schema\n";
     }
     // Create the test database schema
     $tool->createSchema($classes);
     if ($DEBUG) {
         print "schema created\n";
     }
 }
 public static function cleanDatabase($em)
 {
     $tool = new \Doctrine\ORM\Tools\SchemaTool($em);
     $classes = array($em->getClassMetadata('Poc\\PocPlugins\\Tagging\\Driver\\Doctrine2\\Entities\\Cache'), $em->getClassMetadata('Poc\\PocPlugins\\Tagging\\Driver\\Doctrine2\\Entities\\CacheTag'), $em->getClassMetadata('Poc\\PocPlugins\\Tagging\\Driver\\Doctrine2\\Entities\\Tag'));
     $tool->dropDatabase();
     $tool->createSchema($classes);
 }
 private function prepare()
 {
     $cmf = $this->em->getMetadataFactory();
     $metadata = new ClassMetadata('Mapping\\Fixture\\Unmapped\\Timestampable');
     $id = array();
     $id['fieldName'] = 'id';
     $id['type'] = 'integer';
     $id['nullable'] = false;
     $id['columnName'] = 'id';
     $id['id'] = true;
     $metadata->mapField($id);
     $created = array();
     $created['fieldName'] = 'created';
     $created['type'] = 'datetime';
     $created['nullable'] = false;
     $created['columnName'] = 'created';
     $metadata->mapField($created);
     $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_IDENTITY);
     $metadata->setIdGenerator(new \Doctrine\ORM\Id\IdentityGenerator(null));
     $metadata->setPrimaryTable(array('name' => 'temp_test'));
     $cmf->setMetadataFor('Mapping\\Fixture\\Unmapped\\Timestampable', $metadata);
     // trigger loadClassMetadata event
     $evm = $this->em->getEventManager();
     $eventArgs = new \Doctrine\ORM\Event\LoadClassMetadataEventArgs($metadata, $this->em);
     $evm->dispatchEvent(\Doctrine\ORM\Events::loadClassMetadata, $eventArgs);
     if (Version::compare('2.3.0-dev') <= 0) {
         $metadata->wakeupReflection($cmf->getReflectionService());
     }
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->em);
     $schemaTool->dropSchema(array());
     $schemaTool->createSchema(array($this->em->getClassMetadata('Mapping\\Fixture\\Unmapped\\Timestampable')));
 }
Beispiel #7
0
 public function resetDatabase()
 {
     $metadatas = $this->em->getMetadataFactory()->getAllMetadata();
     $tool = new \Doctrine\ORM\Tools\SchemaTool($this->em);
     $tool->dropDatabase();
     $tool->createSchema($metadatas);
 }
Beispiel #8
0
 public function setUp()
 {
     $reader = new \Doctrine\Common\Annotations\AnnotationReader();
     $driver = new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader);
     $config = new \Doctrine\ORM\Configuration();
     $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
     $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
     $config->setProxyDir(sys_get_temp_dir());
     $config->setProxyNamespace('SimpleThings\\EntityAudit\\Tests\\Proxies');
     $config->setMetadataDriverImpl($driver);
     $conn = array('driver' => $GLOBALS['DOCTRINE_DRIVER'], 'memory' => $GLOBALS['DOCTRINE_MEMORY'], 'dbname' => $GLOBALS['DOCTRINE_DATABASE'], 'user' => $GLOBALS['DOCTRINE_USER'], 'password' => $GLOBALS['DOCTRINE_PASSWORD'], 'host' => $GLOBALS['DOCTRINE_HOST']);
     $auditConfig = new AuditConfiguration();
     $auditConfig->setCurrentUsername("beberlei");
     $auditConfig->setAuditedEntityClasses($this->auditedEntities);
     $auditConfig->setGlobalIgnoreColumns(array('ignoreme'));
     $this->auditManager = new AuditManager($auditConfig);
     $this->auditManager->registerEvents($evm = new EventManager());
     if (php_sapi_name() == 'cli' && isset($_SERVER['argv']) && (in_array('-v', $_SERVER['argv']) || in_array('--verbose', $_SERVER['argv']))) {
         $config->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());
     }
     $this->em = \Doctrine\ORM\EntityManager::create($conn, $config, $evm);
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->em);
     $em = $this->em;
     try {
         $schemaTool->createSchema(array_map(function ($value) use($em) {
             return $em->getClassMetadata($value);
         }, $this->schemaEntities));
     } catch (\Exception $e) {
         if ($GLOBALS['DOCTRINE_DRIVER'] != 'pdo_mysql' || !($e instanceof \PDOException && strpos($e->getMessage(), 'Base table or view already exists') !== false)) {
             throw $e;
         }
     }
 }
Beispiel #9
0
 public function runAction()
 {
     $em = $this->getEntityManager();
     $console = $this->getServiceLocator()->get('console');
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);
     $console->writeLine('建立資料表中, 請稍待!!', ColorInterface::GREEN);
     $classes = $em->getMetadataFactory()->getAllMetadata();
     if ($this->params()->fromRoute('re-create-database')) {
         $schemaTool->dropSchema($classes);
     }
     $schemaTool->createSchema($classes);
     // 安裝預設管理人員及選單
     $username = '******';
     $password = \Zend\Math\Rand::getString(8, null, true);
     $user = new \Base\Entity\User();
     $user->setUsername($username);
     $user->setPassword(\Zend\Ldap\Attribute::createPassword($password));
     $user->setDisplayName('管理者');
     $user->setRole('admin');
     $em->persist($user);
     $em->flush();
     $menu = new \Base\Entity\Menu();
     $menu->setName('首頁');
     $menu->setUser($user);
     $params = ['max_records' => 10, 'order_kind' => 'desc', 'term' => ''];
     $menu->setParams(serialize($params));
     $em->persist($menu);
     $em->flush();
     $console->writeLine('建立完成!!', ColorInterface::GREEN);
     $console->writeLine('預設帳號 ' . $username . ', 密碼 ' . $password, ColorInterface::GREEN);
 }
 /**
  * create schema from annotation mapping files
  * @return void
  */
 protected function _createSchemas()
 {
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->_em);
     $classes = array($this->_em->getClassMetadata("\\Ali\\DatatableBundle\\Tests\\TestBundle\\Entity\\Category"), $this->_em->getClassMetadata("\\Ali\\DatatableBundle\\Tests\\TestBundle\\Entity\\Product"), $this->_em->getClassMetadata("\\Ali\\DatatableBundle\\Tests\\TestBundle\\Entity\\Feature"));
     $schemaTool->dropSchema($classes);
     $schemaTool->createSchema($classes);
 }
Beispiel #11
0
function buildSchema()
{
    $em = \Codeception\Module\Doctrine2::$em;
    $tool = new \Doctrine\ORM\Tools\SchemaTool($em);
    $classes = array($em->getClassMetadata('Facilis\\Users\\UserAggregate'), $em->getClassMetadata('Facilis\\Users\\UserData'), $em->getClassMetadata('Facilis\\Users\\OAuth2\\OAuthAccount'));
    $tool->createSchema($classes);
}
 public static function init()
 {
     // Load the user-defined test configuration file, if it exists; otherwise, load
     if (is_readable(__DIR__ . '/TestConfig.php')) {
         $testConfig = (include __DIR__ . '/TestConfig.php');
     } else {
         $testConfig = (include __DIR__ . '/TestConfig.php.dist');
     }
     $zf2ModulePaths = array();
     if (isset($testConfig['module_listener_options']['module_paths'])) {
         $modulePaths = $testConfig['module_listener_options']['module_paths'];
         foreach ($modulePaths as $modulePath) {
             if ($path = static::findParentPath($modulePath)) {
                 $zf2ModulePaths[] = $path;
             }
         }
     }
     $zf2ModulePaths = implode(PATH_SEPARATOR, $zf2ModulePaths) . PATH_SEPARATOR;
     $zf2ModulePaths .= getenv('ZF2_MODULES_TEST_PATHS') ?: (defined('ZF2_MODULES_TEST_PATHS') ? ZF2_MODULES_TEST_PATHS : '');
     static::initAutoloader();
     // use ModuleManager to load this module and it's dependencies
     $baseConfig = array('module_listener_options' => array('module_paths' => explode(PATH_SEPARATOR, $zf2ModulePaths)));
     $config = ArrayUtils::merge($baseConfig, $testConfig);
     $application = \Zend\Mvc\Application::init($config);
     // build test database
     $entityManager = $application->getServiceManager()->get('doctrine.entitymanager.orm_default');
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($entityManager);
     $schemaTool->createSchema($entityManager->getMetadataFactory()->getAllMetadata());
     static::$application = $application;
 }
 public function setUp()
 {
     $config = new \Doctrine\ORM\Configuration();
     $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
     $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ArrayCache());
     $config->setProxyDir(__DIR__ . '/_files');
     $config->setProxyNamespace('DoctrineExtensions\\LargeCollections\\Proxies');
     $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver());
     $conn = array('driver' => 'pdo_sqlite', 'memory' => true);
     #$config->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());
     $this->em = \Doctrine\ORM\EntityManager::create($conn, $config);
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->em);
     $schemaTool->createSchema(array($this->em->getClassMetadata('DoctrineExtensions\\LargeCollections\\Article'), $this->em->getClassMetadata('DoctrineExtensions\\LargeCollections\\Tag'), $this->em->getClassMetadata('DoctrineExtensions\\LargeCollections\\Comment')));
     $article = new Article();
     $tag1 = new Tag();
     $tag2 = new Tag();
     $comment1 = new Comment();
     $comment2 = new Comment();
     $article->addComment($comment1);
     $article->addComment($comment2);
     $article->addTag($tag1);
     $article->addTag($tag2);
     $this->em->persist($article);
     $this->em->persist($tag1);
     $this->em->persist($tag2);
     $this->em->persist($comment1);
     $this->em->persist($comment2);
     $this->em->flush();
     $this->articleId = $article->id();
     $this->em->clear();
 }
Beispiel #14
0
 /**
  * @test
  */
 public function shouldHandleApcQueryCache()
 {
     if (!extension_loaded('apc') || !ini_get('apc.enable_cli')) {
         $this->markTestSkipped('APC extension is not loaded.');
     }
     $config = new \Doctrine\ORM\Configuration();
     $config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ApcCache());
     $config->setQueryCacheImpl(new \Doctrine\Common\Cache\ApcCache());
     $config->setProxyDir(__DIR__);
     $config->setProxyNamespace('Gedmo\\Mapping\\Proxy');
     $config->getAutoGenerateProxyClasses(false);
     $config->setMetadataDriverImpl($this->getMetadataDriverImplementation());
     $conn = array('driver' => 'pdo_sqlite', 'memory' => true);
     $em = \Doctrine\ORM\EntityManager::create($conn, $config);
     $schema = array_map(function ($class) use($em) {
         return $em->getClassMetadata($class);
     }, (array) $this->getUsedEntityFixtures());
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);
     $schemaTool->dropSchema(array());
     $schemaTool->createSchema($schema);
     $this->populate($em);
     $_GET['filterField'] = 'a.title';
     $_GET['filterValue'] = 'summer';
     $query = $em->createQuery('SELECT a FROM Test\\Fixture\\Entity\\Article a');
     $p = new Paginator();
     $view = $p->paginate($query, 1, 10);
     $query = $em->createQuery('SELECT a FROM Test\\Fixture\\Entity\\Article a');
     $view = $p->paginate($query, 1, 10);
 }
 public function setUp()
 {
     if (version_compare(\Doctrine\Common\Version::VERSION, '2.1.0RC4-DEV', '>=')) {
         $this->markTestSkipped('Doctrine common is 2.1.0RC4-DEV version, skipping.');
     } else {
         if (version_compare(\Doctrine\Common\Version::VERSION, '2.1.0-BETA3-DEV', '>=')) {
             $reader = new AnnotationReader();
             $reader->setDefaultAnnotationNamespace('Doctrine\\ORM\\Mapping\\');
             $reader->setIgnoreNotImportedAnnotations(true);
             $reader->setAnnotationNamespaceAlias('Gedmo\\Mapping\\Annotation\\', 'gedmo');
             $reader->setEnableParsePhpImports(false);
             $reader->setAutoloadAnnotations(true);
             $reader = new CachedReader(new \Doctrine\Common\Annotations\IndexedReader($reader), new ArrayCache());
         } else {
             $reader = new AnnotationReader();
             $reader->setAutoloadAnnotations(true);
             $reader->setAnnotationNamespaceAlias('Gedmo\\Mapping\\Annotation\\', 'gedmo');
             $reader->setDefaultAnnotationNamespace('Doctrine\\ORM\\Mapping\\');
         }
     }
     $config = new \Doctrine\ORM\Configuration();
     $config->setProxyDir(TESTS_TEMP_DIR);
     $config->setProxyNamespace('Gedmo\\Mapping\\Proxy');
     $config->setMetadataDriverImpl(new AnnotationDriver($reader));
     $conn = array('driver' => 'pdo_sqlite', 'memory' => true);
     //$config->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());
     $evm = new \Doctrine\Common\EventManager();
     $this->timestampable = new \Gedmo\Timestampable\TimestampableListener();
     $evm->addEventSubscriber($this->timestampable);
     $this->em = \Doctrine\ORM\EntityManager::create($conn, $config, $evm);
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->em);
     $schemaTool->dropSchema(array());
     $schemaTool->createSchema(array($this->em->getClassMetadata(self::ARTICLE)));
 }
 /**
  * データベースを初期化する.
  *
  * データベースを初期化し、マイグレーションを行なう.
  * 全てのデータが初期化されるため注意すること.
  *
  * @link http://jamesmcfadden.co.uk/database-unit-testing-with-doctrine-2-and-phpunit/
  */
 public function initializeDatabase()
 {
     // Get an instance of your entity manager
     $entityManager = $this->app['orm.em'];
     // Retrieve PDO instance
     $pdo = $entityManager->getConnection()->getWrappedConnection();
     // Clear Doctrine to be safe
     $entityManager->clear();
     // Schema Tool to process our entities
     $tool = new \Doctrine\ORM\Tools\SchemaTool($entityManager);
     $classes = $entityManager->getMetaDataFactory()->getAllMetaData();
     // Drop all classes and re-build them for each test case
     $tool->dropSchema($classes);
     $tool->createSchema($classes);
     $config = new Configuration($this->app['db']);
     $config->setMigrationsNamespace('DoctrineMigrations');
     $migrationDir = __DIR__ . '/../../../src/Eccube/Resource/doctrine/migration';
     $config->setMigrationsDirectory($migrationDir);
     $config->registerMigrationsFromDirectory($migrationDir);
     $migration = new Migration($config);
     $migration->migrate(null, false);
     // 通常は eccube_install.sh で追加されるデータを追加する
     $sql = "INSERT INTO dtb_member (member_id, login_id, password, salt, work, del_flg, authority, creator_id, rank, update_date, create_date,name,department) VALUES (2, 'admin', 'test', 'test', 1, 0, 0, 1, 1, current_timestamp, current_timestamp,'管理者','EC-CUBE SHOP')";
     $stmt = $pdo->prepare($sql);
     $stmt->execute();
     $sql = "INSERT INTO dtb_base_info (id, shop_name, email01, email02, email03, email04, update_date, option_product_tax_rule) VALUES (1, 'SHOP_NAME', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', current_timestamp, 0)";
     $stmt = $pdo->prepare($sql);
     $stmt->execute();
 }
Beispiel #17
0
 public function initDb()
 {
     $this->create_database("whathood_test");
     $DEBUG = false;
     // Retrieve the Doctrine 2 entity manager
     $em = $this->getServiceManager()->get('mydoctrineentitymanager');
     // Instantiate the schema tool
     $tool = new \Doctrine\ORM\Tools\SchemaTool($em);
     // Retrieve all of the mapping metadata
     $classes = $em->getMetadataFactory()->getAllMetadata();
     if ($DEBUG) {
         print "dropping schema\n";
     }
     // Delete the existing test database schema
     $tool->dropSchema($classes);
     if ($DEBUG) {
         print "creating schema\n";
     }
     // Create the test database schema
     $tool->createSchema($classes);
     if ($DEBUG) {
         print "schema created\n";
     }
     // don't really know why we have to clear this but it works to stop
     // it when the entity manager doesn't seem to persist shit
     $em->clear();
 }
 private function importSchemaForEm(EntityManager $em)
 {
     $metadata = $em->getMetadataFactory()->getAllMetadata();
     if (!empty($metadata)) {
         $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);
         $schemaTool->createSchema($metadata);
     }
 }
Beispiel #19
0
 protected function dropAndCreateSchema()
 {
     $em = $this->getEntityManager();
     $metadatas = $em->getMetadataFactory()->getAllMetadata();
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->getEntityManager());
     $schemaTool->dropSchema($metadatas);
     $schemaTool->createSchema($metadatas);
 }
 protected function setUp()
 {
     parent::setUp();
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->_em);
     try {
         $schemaTool->createSchema(array($this->_em->getClassMetadata('Doctrine\\Tests\\ORM\\Functional\\Train'), $this->_em->getClassMetadata('Doctrine\\Tests\\ORM\\Functional\\TrainDriver'), $this->_em->getClassMetadata('Doctrine\\Tests\\ORM\\Functional\\TrainOwner'), $this->_em->getClassMetadata('Doctrine\\Tests\\ORM\\Functional\\Waggon'), $this->_em->getClassMetadata('Doctrine\\Tests\\ORM\\Functional\\TrainOrder')));
     } catch (\Exception $e) {
     }
 }
 /**
  * Creates the needed DB schema using Doctrine's SchemaTool. If tables already
  * exist, this will throw an exception.
  *
  * @param string $outputPathAndFilename A file to write SQL to, instead of executing it
  * @return string
  */
 public function createSchema($outputPathAndFilename = null)
 {
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->entityManager);
     if ($outputPathAndFilename === null) {
         $schemaTool->createSchema($this->entityManager->getMetadataFactory()->getAllMetadata());
     } else {
         file_put_contents($outputPathAndFilename, implode(PHP_EOL, $schemaTool->getCreateSchemaSql($this->entityManager->getMetadataFactory()->getAllMetadata())));
     }
 }
Beispiel #22
0
 public function processAction()
 {
     $em = $this->getComponent('entityManager');
     $tool = new \Doctrine\ORM\Tools\SchemaTool($em);
     $classes = array($em->getClassMetadata('application\\modules\\user\\models\\User'), $em->getClassMetadata('application\\modules\\comment\\models\\Comment'), $em->getClassMetadata('application\\modules\\proposal\\models\\Proposal'), $em->getClassMetadata('application\\modules\\userrequest\\models\\UserRequest'), $em->getClassMetadata('application\\modules\\category\\models\\Category'), $em->getClassMetadata('application\\modules\\vote\\models\\ProposalVote'), $em->getClassMetadata('application\\modules\\vote\\models\\CommentVote'));
     $tool->dropDatabase();
     $tool->createSchema($classes);
     $this->createRequest('database', 'fill')->execute();
 }
Beispiel #23
0
 protected final function importDatabaseSchema()
 {
     $em = self::$kernel->getContainer()->get('em');
     $metadata = $em->getMetadataFactory()->getAllMetadata();
     if (!empty($metadata)) {
         $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);
         $schemaTool->createSchema($metadata);
     }
 }
Beispiel #24
0
 public function setUp()
 {
     parent::setUp();
     try {
         $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($this->_em);
         $schemaTool->createSchema(array($this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC729A'), $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC729B')));
     } catch (\Exception $e) {
     }
 }
 public function preTestSetUp(EntityManagerEventArgs $eventArgs)
 {
     $this->preTestEvent = true;
     $em = $eventArgs->getEntityManager();
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);
     $classes = array($em->getClassMetadata(__NAMESPACE__ . "\\BlogPost"), $em->getClassMetadata('DoctrineExtensions\\Versionable\\Entity\\ResourceVersion'));
     $schemaTool->dropSchema($classes);
     $schemaTool->createSchema($classes);
 }
Beispiel #26
0
 public function fromEntities()
 {
     $metadataClasses = $this->getMetadataClassesOfEntities();
     if (count($metadataClasses) > 0) {
         $this->dropAll();
         $tool = new \Doctrine\ORM\Tools\SchemaTool($this->entityManager);
         $tool->createSchema($metadataClasses);
     }
 }
 /**
  * @param \SystemContainer $container
  * @return EntityManager
  */
 public function createDatabase(\SystemContainer $container)
 {
     // Create database
     $em = $container->getByType('\\Doctrine\\ORM\\EntityManager');
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);
     $metadatas = $em->getMetadataFactory()->getAllMetadata();
     $schemaTool->createSchema($metadatas);
     return $em;
 }
 public function preTestSetUp(Event\EntityManagerEventArgs $eventArgs)
 {
     $this->preTestEvent = true;
     $em = $eventArgs->getEntityManager();
     $schemaTool = new \Doctrine\ORM\Tools\SchemaTool($em);
     $classes = array($em->getClassMetadata(__NAMESPACE__ . "\\User"));
     $schemaTool->dropSchema($classes);
     $schemaTool->createSchema($classes);
 }
 /**
  */
 protected function generateSchema()
 {
     $metadatas = $this->getMetadatas();
     if (!empty($metadatas)) {
         $tool = new \Doctrine\ORM\Tools\SchemaTool($this->em);
         $tool->dropSchema($metadatas);
         $tool->createSchema($metadatas);
     }
 }
 public function setUp()
 {
     $this->entityManager = EntityManager::create(self::$dbParams, self::$config);
     $tool = new \Doctrine\ORM\Tools\SchemaTool($this->entityManager);
     $classes = array($this->entityManager->getClassMetadata(\Governor\Framework\Saga\Repository\Orm\AssociationValueEntry::class), $this->entityManager->getClassMetadata(\Governor\Framework\Saga\Repository\Orm\SagaEntry::class));
     $tool->createSchema($classes);
     $this->serializer = new JMSSerializer();
     $this->repository = new OrmSagaRepository($this->entityManager, new NullResourceInjector(), $this->serializer);
 }