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

It don't work for use a model class in Yii2 #302

Open
lluck42 opened this issue May 11, 2020 · 1 comment
Open

It don't work for use a model class in Yii2 #302

lluck42 opened this issue May 11, 2020 · 1 comment

Comments

@lluck42
Copy link

lluck42 commented May 11, 2020

Crunz version: 2.1

PHP version: 7.2

Operating system type and version:linux

Description
in Yii2 framework
It don't work for use a model class in Yii2

<?php
use Crunz\Schedule;
$schedule = new Schedule();
$task = $schedule->run(function(){
    (new \console\models\app\Run)->createAppTask();
});

$task
    ->everyMinute()
    ->description('任务生成:');

return $schedule;

Additional context

Fatal error: Uncaught Error: Class 'console\models\app\Run' not found in F:\html\hqq\vendor\jeremeamia\superclosure\src\SerializableClosure.php(210) : eval()'d code:2
@PabloKowalczyk
Copy link
Collaborator

Hello, does following code works?

<?php
use Crunz\Schedule;
$schedule = new Schedule();

// Run code directly
(new \console\models\app\Run)->createAppTask();

$task = $schedule->run(function(){
    (new \console\models\app\Run)->createAppTask();
});

$task
    ->everyMinute()
    ->description('任务生成:');

return $schedule;

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

No branches or pull requests

2 participants