There are no tasks defined in the “product” namespace.
Sunday, April 5th, 2009As you might know, I’m using the symfony PHP framework for many of my projects. Especially on bigger projects like filmprices.com I find it very useful.
Symfony have somthing called tasks that you can run from command line of your server. Tasks together with a cronjob would be great combination for updating the product list from the different shops in filmprices.com. So I set up a cronjob for running my product:update task looking somthing like this:
0 5 * * * ~/path/to/my/symfony/poject/symfony product:update
But I just got the following error message:
There are no tasks defined in the “product” namespace.”
The problem is that the symfony cli need to be run from the symfony project directory so it do not manage to find my product namespace. I did not find any similar examples on google so I did some basic “try and fail” with my cron script. I finally managed to get it to work with the following script:
0 5 * * * cd ~/path/to/my/symfony/poject && ./symfony product:update
When looking at the solution I guess this should have been easy for me to figure out, but I have not worked much with cronjobs earlier. So hope this helps if you ever run into a “There are no tasks defined in the “<namespace name>” namespace.” message when setting up cronjobs with symfony tasks.
As a side note you might have noticed I set up my script to only update products once a day. I will increase this for the shops that update their products lists often when I take this project out of beta. So do not worry the products and prices will be up to date!