wa0x6e / Cake-Resque

Resque plugin for CakePHP : for creating background jobs that can be processed offline later
MIT License
159 stars 56 forks source link

CakeReque isn't working with tasks in Shell #2158 #65

Closed meotimdihia closed 10 years ago

meotimdihia commented 10 years ago

step 1

<?php 
App::uses('AppShell', 'Console/Command');

class NtfShell extends AppShell {

    public $tasks = array('Apns');

    public function test() {
            $this->Apns->test();
    };

step 2

   CakeResque::enqueue(
        'default', 'NtfShell', array('test')
   );

result

Fatal error: Call to a member function test() on a non-object in ....

meotimdihia commented 10 years ago

It works if i add this line $this->loadTasks() in perform method in AppShell

    public function perform()
    {
        $this->initialize();
        $this->loadTasks();
        return $this->runCommand($this->args[0], $this->args);
    }

it seems you need to update documentation .

wa0x6e commented 10 years ago

Fixed the documentation, thanks