Exemplo n.º 1
0
 protected function setUp()
 {
     parent::setUp();
     $this->application->add(self::$kernel->getContainer()->get('hautelook_alice.doctrine.command.load_command'));
     $this->entityManager = $this->application->getKernel()->getContainer()->get('doctrine')->getManager();
     // Create shard database
     $connection = $this->entityManager->getConnection();
     $connection->connect(1);
     $this->runConsole('doctrine:schema:drop', ['--force' => true]);
     $this->runConsole('doctrine:schema:create');
     $connection->connect(0);
 }
 protected function setUp()
 {
     parent::setUp();
     $this->application->add(self::$kernel->getContainer()->get('hautelook_alice.doctrine.command.load_command'));
     $doctrineORM = $this->application->getKernel()->getContainer()->get('doctrine');
     $this->defaultEntityManager = $doctrineORM->getManager();
     // Create required MySQL databases for ORM
     $this->runConsole('doctrine:database:create', ['--if-not-exists' => true, '--connection' => 'mysql']);
     $this->runConsole('doctrine:database:create', ['--if-not-exists' => true, '--connection' => 'mysql', '--shard' => 1]);
     // Reset ORM schemas
     foreach ($doctrineORM->getManagers() as $name => $manager) {
         $this->runConsole('doctrine:schema:drop', ['--force' => true, '--em' => $name]);
         $this->runConsole('doctrine:schema:create', ['--em' => $name]);
         $connection = $manager->getConnection();
         if ($connection instanceof PoolingShardConnection) {
             $connection->connect(1);
             $this->runConsole('doctrine:schema:drop', ['--force' => true, '--em' => $name]);
             $this->runConsole('doctrine:schema:create', ['--em' => $name]);
             $connection->connect(0);
         }
     }
 }
 protected function setUp()
 {
     parent::setUp();
     $this->application->add(self::$kernel->getContainer()->get('hautelook_alice.doctrine.command.load_command'));
     $this->entityManager = $this->application->getKernel()->getContainer()->get('doctrine')->getManager();
 }