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

Instructions for setting up on CakePHP 3 #95

Closed voycey closed 9 years ago

voycey commented 9 years ago

Hi Wan,

I am trying to get this set up on Cake3, is there any chance you can update the README with any differences (for example I cant pass in a custom config when loading the plugin any more).

With the latest version I can get stats to show me the workers, I can get a worker to start but as soon as I try to process a job I get:

2015-09-17 06:03:12 Warning: Warning (2): Attempt to assign property of non-object in [/var/www/vhosts/forumapi/vendor/kamisama/php-resque-ex/lib/Resque/Job.php, line 178]
Trace:
Cake\Error\BaseErrorHandler::handleError() - CORE/src/Error/BaseErrorHandler.php, line 139
Resque_Job::getInstance() - ROOT/vendor/kamisama/php-resque-ex/lib/Resque/Job.php, line 178
Resque_Job::perform() - ROOT/vendor/kamisama/php-resque-ex/lib/Resque/Job.php, line 191
Resque_Worker::perform() - ROOT/vendor/kamisama/php-resque-ex/lib/Resque/Worker.php, line 278
Resque_Worker::work() - ROOT/vendor/kamisama/php-resque-ex/lib/Resque/Worker.php, line 241
startWorker - ROOT/vendor/kamisama/php-resque-ex/bin/resque, line 109
[main] - ROOT/vendor/kamisama/php-resque-ex/bin/resque, line 100

I have tried the following:

Created AppShell with:

<?php
namespace App\Shell;

use Cake\Console\Shell;

class AppShell extends Shell
{
    /**
     * Perform function needed for CakeResque
     * @return mixed
     */
    public function perform()
    {
        $this->initialize();
        $this->loadTasks();
        return $this->runCommand($this->args[0], $this->args);
    }
}

As per the 2.x docs and then had my shell extend this, I have tried it without and same issue.

Also tried with:

 public function perform()
    {
        $this->initialize();
        $this->{array_shift($this->args)}();
    }

Which is what I have working fine in my 2.x app.

Some pointers would be appreciated, I have a fair bit of code for custom configuration that I have been playing around with on my local machine so if this is a task that needs to be done, once i have it working I should be able to do a PR.

Thanks

wa0x6e commented 9 years ago

Cake 3 compatibility is work in progress, and is not ready yet

voycey commented 9 years ago

OK - anything that needs doing? I can probably update some of the tests to PHPUnit 4, @RTLer @wa0x6e are either of you working on these at the mo - if so where shall I start?

wa0x6e commented 9 years ago

This is the roadmap: https://github.com/wa0x6e/Cake-Resque/issues/90