symfony init-batch

by rp

while building a newsletter app in symfony I had to write a batch process, unfortunately there isnt enough documentation for doing that on the symfony website. However I would just get the following error:

unagi:htdocs rajatpandit$ symfony init-batch backend prod mailer
  [Exception]
  The specified batch "backend" does not exist.

Digging in the code, I figured out that the correct syntax is:

unagi:htdocs rajatpandit$ symfony init-batch default mailer backend
>> file+     /Users/rajatpandit/websites/edu/htdocs/batch/mailer.php
>> tokens    /Users/rajatpandit/websites/edu/htdocs/batch/mailer.php

where:

  • default: Default skeleton for the batch script
  • mailer: Name of the batch script that you want to create
  • frontend: Name of the application under which you want to create the batch file.

The newly created batch script is created under the folder /batch folder