Monthly Archive for luty, 2009

Symfony 1.2 - tasks and cron

I was wondering if there is any simple way in Symfony for calling cron job. I found in the documentation that we can use Batch files - it is kind of PHP script that looks similar to symfony front controller, all we need to do is to initalize symfony, parse project and application Configuration. Quite cool but there is better way (just in my opinion) to access all symfony features from the command line: tasks.
Every time we are creating project, generating modules, building models/forms we use standard symfony tasks. Task are grouped by namespace and name - this allows us to build intuitive script names. For example namespace: propel or doctrine, and the task name: build-model, build-sql. Why we should use tasks instead of batch files? Tasks are really simple, powerful and they take care of parsing command line arguments and options, initalizing needed configuration and classes. To create a simple task we have to create a class that exetend sfBaseTask and put it into lib/task/ directory. File name must ends with “Task.class.php” to be properly loaded.
Another great thing about tasks is that Symfony also provide task for generating new, custom tasks :)
Continue reading ‘Symfony 1.2 - tasks and cron’

Symfony + jQuery Flexigrid

Nothing special but some of you had problems putting it together. So, i decided to write simple tutorial describing how to use jquery Flexigrid with Symfony. I will use the same data as in the tutorial: Zend Framework + Doctrine + jQuery Grid . Eveything will be the same, except that we will use Symfony instead of Zend.

First we need to create new symfony project:

symfony generate:project someProjectName

or simply download sf_sandbox.

Next step is to create symfony app:

symfony generate:app frontend

Then we need one module, for example “grid”:

symfony generate:module frontend grid

Continue reading ‘Symfony + jQuery Flexigrid’




About me:

  • PHP programmer
  • Symfony developer
  • Zend framework developer

Categories: