Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Task and oil
  • I have a method that update my database from .txt files. This works fine from the browser when I go to : http://localhost/intranet/public/admin/stockvn/integration

    I'd like to use windows task scheduler to launch a command line with oil, so i create a Task inside fuel/app :

    class Import
    {
    public static function run()
    {
    Admin_Stockvn::action_integration();
    }

    but when i do : php oil refine import   ... I have this error :
    PHP Fatal error:  Class 'Fuel\Tasks\Admin_Stockvn' not found in C:\wamp\www\intranet\fuel\app\tasks\import.php on line 20
    PHP Stack trace:
    PHP   1. {main}() C:\wamp\www\intranet\oil:0
    PHP   2. Oil\Command::init() C:\wamp\www\intranet\oil:46
    PHP   3. call_user_func() C:\wamp\www\intranet\fuel\packages\oil\classes\command.php:120
    PHP   4. Oil\Refine::run() C:\wamp\www\intranet\fuel\packages\oil\classes\command.php:120
    PHP   5. call_user_func_array() C:\wamp\www\intranet\fuel\packages\oil\classes\refine.php:99
    PHP   6. Fuel\Tasks\Import->run() C:\wamp\www\intranet\fuel\packages\oil\classes\refine.php:99
    Error - Class 'Fuel\Tasks\Admin_Stockvn' not found in APPPATH/tasks/import.php on line 20

    I know that my method is not supposed to be called on command line.

    Sorry if it's a dumb question, but I'm totally confuse with this section. Need help.

    Thx in advance.
  • HarroHarro
    Accepted Answer
    Tasks (and Migrations) don't follow the cascading filesystem principe, and aren't autoloadable.

    So a class called "Admin_Stockvn" will be loaded from "admin_stockvn.php" in the tasks folder, no subdirectories are supported.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion