logo
Ask your Symfony questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$5
[pakeException] Task is not defined.

I'm working on an old site that runs Symfony 1.0

2 weeks ago I wrote a script to import some data from one database to another database. The script worked, and the data was imported. Now I want to run it again, but the script won't work. If I do this:

symfony batch/import_data.php


I get:

[pakeException]   Task  "batch/import_data.php" is not defined. 


I also tried this:

symfony import_data.php


But I got the same error.

I ran "symfony cc" and tried again, but I got the same error.

The other programmers who are working on this project have been making a lot of changes to the configuration, so I am thinking possibly they made a change that is causing this to fail? Does anyone have any ideas where I should start to look?

This question has been answered.

marshall | 04/16/10 at 7:40pm Edit


(4) Responses

See a threaded view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    04/19/10
    11:41am
    Arturo Linares says:

    If it is a task, it should live in lib/task/YourTask.class.php (for sf1.1 and above) but for 1.0 you can execute it like:

    php batch/import_data.php


    Check your script has the front controller information in the header, something like:

    define('SF_ROOT_DIR', realpath(dirname(__FILE__).'/..'));
    define('SF_APP', 'frontend');
    define('SF_ENVIRONMENT', 'dev');
    define('SF_DEBUG', true);

    require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');

    Previous versions of this answer: 04/16/10 at 7:53pm | 04/16/10 at 7:54pm | 04/16/10 at 7:59pm

  • avatar
    Last edited:
    04/16/10
    8:26pm
    Martin Palacio says:

    is your import_data.php a symfony task or just a plain php script?
    If the latter is correct, try:


    cd [/your/script/folder]
    php import_data.php

  • avatar
    Last edited:
    04/17/10
    5:08am
    Jakub Zalas says:

    You tried to pass a script path as an argument to symfony command. You should've used name of the task intead. Run 'symfony' in your project directory to list all available tasks.

    Also, if you edit your script you'll notice that tasks are really simple functions. Before each one there should be two pake calls: pake_task() and pake_desc(). First defines task name which you can use if you want to run it through symfony.

    Example task:


    pake_task('import-data');
    pake_desc('Imports data');

    function run_import_data($task, $args)
    {
    echo 'hello!';
    }


    You can run it with:


    symfony import-data


    I'm not sure if your scripts are built this way but this is how it was done in symfony 1.0. It looks like you have simple php scripts there which can be run by php command. Tasks need to be put into plugins in symfony 1.0 (i.e. plugins/myTaskPlugin/data/tasks/myPakeMyTask.php). Otherwise symfony won't find them.

    Previous versions of this answer: 04/17/10 at 5:08am | 04/17/10 at 5:08am

  • avatar
    Last edited:
    04/16/10
    8:29pm
    Martin Palacio says:

    EDIT: Sorry, Arturo already say that...

This question has expired.





Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.