1.4でのバッチ処理作成

$ ./symfony generate:task registrant

$ vim lib/task/registrantTask.class.php


executeメソッドの中身

「setCurrentConnection」でデータベースの接続先を変更している。

バッチの走らせ方

例えば、

  • $this->namespace = 'batch'
  • $this->name = 'registrant'

と書いておくと、以下のコマンドで実行できる。

$ ./symfony batch:registrant