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

Hi Sir! I need your help, the handle not run. #24

Open
solkel88 opened this issue Jan 3, 2024 · 0 comments
Open

Hi Sir! I need your help, the handle not run. #24

solkel88 opened this issue Jan 3, 2024 · 0 comments

Comments

@solkel88
Copy link

solkel88 commented Jan 3, 2024

use WpQueuedJobs\Jobs\Job;

class BackgroundJob extends Job
{
public function handle()
{
$data = $this->data;
file_put_contents('logs.txt', json_encode($data).PHP_EOL, FILE_APPEND);
$res = (new WC_Product_CSV_Importer($data['file'], $data['data']))->import();
file_put_contents('logs_result.txt', json_encode($res).PHP_EOL, FILE_APPEND);
}
}

================other class=======================
the other class is Axnt_Import_Controller and get Data from it, but BackgroundJob class is not work ,can not get $this->data. needs more config data let it works ?? Wordpress I don't understand。 Thank you very much!!

$import = new Axnt_Import_Controller();
$import->file = $upload['file'];
wpj()->addJob(BackgroundJob::class, $import->import())->dispatch();

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

1 participant