Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
external class and oil
  • hi, am trying to execute a command with oil script, so when i include or use Fuel::load to load a class , it says class not found, below  what am doing :

    in the vendor folder i placed a class named eden.php, then i created a task function containing the following code:
    public static function foo(){

    Fuel::load(APPPATH . 'vendor/eden.php');
    $s3 = new Eden_Amazon_S3();

    }
    when i execute the task in command line i got the error : "PHP Fatal error:  Class 'Fuel\Tasks\Eden_Amazon_S3' not found in C:\Server\www\a
    brutis\app\tasks\job.php on line 80
    Error - Class 'Fuel\Tasks\Eden_Amazon_S3' not found in APPPATH/tasks/job.php
    on line 80"

    it can't find the class!! the same thing happens when i use include or autoloader!!
  • HarroHarro
    Accepted Answer
    You include it in the current scope of the script, with is the Fuel\Tasks namespace, but the file does not contain a namespace, the class is defined in global.

    So you need to use
    $s3 = new \Eden_Amazon_S3();
    to indicate you want to load it from the global namespace.
  • thank you again, you saved me :D

Howdy, Stranger!

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

In this Discussion