Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1 error #397

Closed
ooo4321 opened this issue Oct 7, 2020 · 2 comments
Closed

#1 error #397

ooo4321 opened this issue Oct 7, 2020 · 2 comments
Labels

Comments

@ooo4321
Copy link

ooo4321 commented Oct 7, 2020

Hello,

I have a bug on PHP 7.3 installed Yii2 Advanced , i installed yii2-queue with composer,

in Backend and common config /console i have the following config in place :

'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'bootstrap' => [
    'queue',
],
'components' => [
    'cache' => [
        'class' => \yii\caching\FileCache::class,
    ],
    'queue' => [
        'class' => \yii\queue\file\Queue::class,
        'path' => '@common/runtime/queue',
        'as log' => \yii\queue\LogBehavior::class
    ],
],

in one backend controller i have defined :

class Email22Job extends BaseObject implements \yii\queue\JobInterface
{
public $to;
public function execute($queue)
{
echo 'something';
}
}

and i run it from the same controller

Yii::$app->queue->push( new Email22Job());

all good but when i do from the backend yii queue/listen i get :

[11] unknown job (attempt: 1, PID: 696) is finished with error: yii\queue\InvalidJobException: Job must be a JobInterface instance instead of __PHP_Incomplete_Class#1
(
[__PHP_Incomplete_Class_Name] => 'backend\controllers\Email22Job'
[to] => null
). in /var/www/vendor/yiisoft/yii2-queue/src/Queue.php:277
Stack trace:
#0 /var/www/vendor/yiisoft/yii2-queue/src/Queue.php(230): yii\queue\Queue->unserializeMessage('O:30:"backend\c...')
#1 /var/www/vendor/yiisoft/yii2-queue/src/cli/Queue.php(162): yii\queue\Queue->handleMessage('11', 'O:30:"backend\c...', '300', '1')
#2 /var/www/vendor/yiisoft/yii2-queue/src/cli/Command.php(146): yii\queue\cli\Queue->execute('11', 'O:30:"backend\c...', '300', '1', '696')
#3 [internal function]: yii\queue\cli\Command->actionExec('11', '300', '1', '696')
#4 /var/www/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#5 /var/www/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams(Array)
#6 /var/wwwvendor/yiisoft/yii2/console/Controller.php(179): yii\base\Controller->runAction('exec', Array)
#7 /var/www/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('exec', Array)
#8 /var/www/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('queue/exec', Array)
#9 /var/www/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('queue/exec', Array)
#10 /var/www/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(yii\console\Request))
#11 /var/www/backend/yii(27): yii\base\Application->run()
#12 {main}.

Any idea ? Thank you

@bizley bizley added the question label Oct 7, 2020
@yii-bot
Copy link

yii-bot commented Oct 7, 2020

Thank you for your question.
In order for this issue tracker to be effective, it should only contain bug reports and feature requests.

We advise you to use our community driven resources:

If you are confident that there is a bug in the framework, feel free to provide information on how to reproduce it. This issue will be closed for now.

This is an automated comment, triggered by adding the label question.

@yii-bot yii-bot closed this as completed Oct 7, 2020
@shouhuori
Copy link

The 'console.php' should be have a same alias config with the web.php,like:

'aliases' => [
        '@micro' => __DIR__,
    ],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants