My cronjob is defined as follows:
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<job instance="VendorModuleModelStatus" method="update" name="vendor_module_status_update">
<schedule>0 */2 * * *</schedule>
</job>
</group>
</config>
Class VendorModuleModelStatus
exists and manual test below works fine:
<?php
declare(strict_types=1);
use MagentoFrameworkAppBootstrap;
use MagentoFrameworkAppHttp as Http;
use MagentoFrameworkAppInterface as AppInterface;
require '/path/to/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
class TestApp extends Http implements AppInterface
{
public function launch()
{
$update = $this->_objectManager->get(VendorModuleModelStatus::class);
$update->update();
echo get_class($update);
return $this->_response;
}
public function catchException(Bootstrap $bootstrap, Exception $exception): bool
{
return false;
}
}
/** @var Http $app */
$app = $bootstrap->createApplication('TestApp');
$bootstrap->run($app);
However for some reason execution via cronjob throws:
Class VendorModuleModelStatus does not exist
Any idea what could be a reason?