cancel
Showing results for 
Search instead for 
Did you mean: 

How to call Admin Backend Controller via cron job in Magento 2

How to call Admin Backend Controller via cron job in Magento 2

I want to automate the import in magento 2.

 

How can I call vendor/magento/module-import-export/Controller/Adminhtml/Import/Validate.php via cron?

1 REPLY

Re: How to call Admin Backend Controller via cron job in Magento 2

Hi @Jens_Noma,

 

You shouldn't be able to do that becase the adminhtml is protected (ACL rules, authtentication) and cron jobs runs in a different area (frontend, adminthml, cron).

I guess you want to get this part of the controller into your cronjob:

 

$this->processValidationResult($import->validateSource($source), $resultBlock);

You should check how to be able to execute the validation on your job.

 

(my 2 cents)

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"