Ejemplo n.º 1
0
 public function listTables()
 {
     $tables = DB::getDoctrineSchemaManager()->listTables();
     $data = [];
     foreach ($tables as $table) {
         $data[] = $table->getName();
     }
     return $data;
 }
Ejemplo n.º 2
0
 protected function truncate($table = null)
 {
     if (is_string($table)) {
         return DB::table($table)->delete();
     }
     $tables = DB::getDoctrineSchemaManager()->listTableNames();
     foreach ($tables as $table) {
         if ($this->isVerbose()) {
             $this->info('Truncating ' . $table);
         }
         DB::table($table)->delete();
     }
 }
Ejemplo n.º 3
0
 /**
  * @return Table[] The tables, either from cache or from the DoctrineSchemaManager.
  */
 private function getTables()
 {
     if ($this->tables == null) {
         if (Cache::has(self::KEY_TABLE_INFO)) {
             $this->tables = Cache::get(self::KEY_TABLE_INFO);
         } else {
             $this->tables = array();
             $doctrineSchemaManager = DB::getDoctrineSchemaManager();
             $tables = $doctrineSchemaManager->listTables();
             /* @var $tables Table[] */
             foreach ($tables as $table) {
                 $this->tables[$table->getName()] = $table;
             }
             Cache::put(self::KEY_TABLE_INFO, $this->tables, 1);
         }
     }
     return $this->tables;
 }
Ejemplo n.º 4
0
 /**
  * Get column.
  *
  * @return string
  */
 public function getColumns()
 {
     return DB::getDoctrineSchemaManager()->listTableDetails($this->getTable())->getColumns();
 }