_configValueFactory = $configValueFactory; parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data); } /** * Cron settings after save * * @return $this */ public function afterSave() { $cronExprString = ''; $time = explode( ',', $this->_configValueFactory->create()->load('paypal/fetch_reports/time', 'path')->getValue() ); if ($this->_configValueFactory->create()->load('paypal/fetch_reports/active', 'path')->getValue()) { $interval = $this->_configValueFactory->create()->load(self::CRON_MODEL_PATH_INTERVAL, 'path')->getValue(); $cronExprString = "{$time[1]} {$time[0]} */{$interval} * *"; } $this->_configValueFactory->create()->load( self::CRON_STRING_PATH, 'path' )->setValue( $cronExprString )->setPath( self::CRON_STRING_PATH )->save(); return parent::afterSave(); } }