private function setupTables()
 {
     if (!is_null($this->tables)) {
         $this->tables = explode(',', $this->tables);
     } else {
         $schema = $this->db->getDoctrineSchemaManager();
         $this->tables = $schema->listTableNames();
     }
 }
 /**
  * Fetch the table fields for the class.
  *
  * @param  string $tableName
  * @return array
  */
 public function getColumns($tableName)
 {
     // We only want to fetch the table details
     // once. We'll store these fields with a
     // $columns property for future fetching.
     if (isset(static::$columns[$this->tableName])) {
         return static::$columns[$this->tableName];
     }
     // This will only run the first time the factory is created.
     return static::$columns[$this->tableName] = $this->db->getDoctrineSchemaManager()->listTableDetails($tableName)->getColumns();
 }
 /**
  * Fetch the table fields for the class.
  *
  * @param  string $tableName
  * @return array
  */
 public function getColumns($tableName)
 {
     // We only want to fetch the table details
     // once. We'll store these fields with a
     // $columns property for future fetching.
     if (isset(static::$columns[$this->tableName])) {
         return static::$columns[$this->tableName];
     }
     $schema_manager = $this->db->getDoctrineSchemaManager($tableName);
     // map enum and set to string, since they are not supported yet by doctrine
     $schema_manager->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
     $schema_manager->getDatabasePlatform()->registerDoctrineTypeMapping('set', 'string');
     // This will only run the first time the factory is created.
     return static::$columns[$this->tableName] = $schema_manager->listTableColumns($tableName);
 }
 private function initializeTruncate()
 {
     $schema = $this->db->getDoctrineSchemaManager();
     $tables = $schema->listTableNames();
     $this->truncateTables($tables);
 }