Hi there,
does anyone know how I can reference a Model's lass from within a task?
having my class in /app/classes/model/Google/Adwords/myclass.php I try to reference it from my /app/tasks/mytask.php like this: $foo = new Model_Google_Adwords_Myclass();
But it fails as it searches within /Fuel/Tasks/Model_Google_Adwords_Myclass ...
Any help would be appreciated.
Best regards,
Jonas
First, paths and filenames should be lower class, so /app/classes/model/google/adwords/myclass.php.
And second, FuelPHP's classes are namespaced. If you load something from another namespace, you will have to tell the autoloader that.
In this case, the task class lives in the "Fuel/Tasks" namespace, while your model lives in the global namespace.
// prefix the class with a backslash to load from global
$foo = new \Model_Google_Adwords_Myclass();