true)); $dbh->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING); $dbh->beginTransaction(); $query = "INSERT INTO chapter ( id , book , paragraph, language , title , channel_id , progress,updated_at ) VALUES ( ? , ? , ? , ? , ? , ? , ? , ? )"; try{ $stmt = $dbh->prepare($query); }catch(PDOException $e){ Log::info($e); return 1; } $bar = $this->output->createProgressBar(ProgressChapter::count()); foreach (ProgressChapter::select(['uid','book','para', 'lang','title','channel_id','progress','updated_at'])->cursor() as $row) { $currData = array( $row->uid, $row->book, $row->para, $row->lang, $row->title, $row->channel_id, $row->progress, $row->updated_at, ); $stmt->execute($currData); $bar->advance(); } $dbh->commit(); $bar->finish(); return 0; } }