true)); $dbh->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING); $dbh->beginTransaction(); $query = "INSERT INTO dhamma_terms ( uuid , word , word_en , meaning , other_meaning , note , tag , channel_id, language, owner, editor_id, created_at,updated_at,deleted_at) VALUES ( ? , ? , ? , ? , ? , ? , ? , ? , ?, ?, ?, ?, ?, ? )"; try { $stmt = $dbh->prepare($query); } catch (\PDOException $e) { Log::error($e->getMessage(), ['exception' => $e]); return 1; } $bar = $this->output->createProgressBar(DhammaTerm::count()); foreach ( DhammaTerm::select([ 'guid', 'word', 'word_en', 'meaning', 'other_meaning', 'note', 'tag', 'channal', 'language', "owner", "editor_id", "created_at", "updated_at", "deleted_at" ]) ->cursor() as $row ) { $currData = array( $row->guid, $row->word, $row->word_en, $row->meaning, $row->other_meaning, $row->note, $row->tag, $row->channal, $row->language, $row->owner, $row->editor_id, $row->created_at, $row->updated_at, $row->deleted_at, ); $stmt->execute($currData); $bar->advance(); } $dbh->commit(); $bar->finish(); $this->info(' time=' . (time() - $startAt) . 's'); Log::info('task export offline term-table finished'); return 0; } }