/**
  * do the thing here.
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $driver = new DoctrineAdapter();
     $driver->init();
     $em = $driver->getManager();
     $classes = loadAppModels();
     $schema = new SchemaTool($em);
     $models = [];
     try {
         $schemaManager = $em->getConnection()->getSchemaManager();
         foreach ($classes as $class) {
             $metadata = $em->getClassMetadata($class);
             $table_name = $metadata->getTableName();
             if ($schemaManager->tablesExist([$table_name]) == true) {
                 array_push($models, $metadata);
             }
         }
         if (count($models) > 0) {
             $schema->dropSchema($models);
         } else {
             $output->writeln('Nao ha models exportados para o banco de dados');
         }
     } catch (\Doctrine\ORM\Mapping\MappingException $e) {
         $output->writeln('Erro encontrado:');
         $output->writeln($e->getMessage());
         return;
     }
     $output->writeln('Tabelas removidas com sucesso.');
 }
 /**
  * do the thing here.
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $driver = new DoctrineAdapter();
     $driver->init();
     $em = $driver->getManager();
     $classes = loadAppModels();
     $schema = new SchemaTool($em);
     $models = [];
     try {
         $schemaManager = $em->getConnection()->getSchemaManager();
         foreach ($classes as $class) {
             $metadata = $em->getClassMetadata($class);
             $table_name = $metadata->getTableName();
             if ($schemaManager->tablesExist([$table_name]) != true) {
                 $models[] = $metadata;
             }
         }
         if (count($models) > 0) {
             $schema->createSchema($models);
         } else {
             $output->writeln('Sem Models para exportar');
         }
         if ($input->getOption('update')) {
             $models = [];
             foreach ($classes as $class) {
                 $metadata = $em->getClassMetadata($class);
                 $table_name = $metadata->getTableName();
                 if ($schemaManager->tablesExist([$table_name]) == true) {
                     $models[] = $metadata;
                 }
             }
             if (count($models) > 0) {
                 $schema->updateSchema($models);
             } else {
                 $output->writeln('Sem models para atualizar');
             }
         }
     } catch (\Doctrine\ORM\Mapping\MappingException $e) {
         $output->writeln('Erro encontrado:');
         $output->writeln($e->getMessage());
     }
     $output->writeln('Banco de dados sincronizado com sucesso.');
 }