14 class Alert extends \Magento\Framework\App\Config\Value
19 const CRON_STRING_PATH =
'crontab/default/jobs/catalog_product_alert/schedule/cron_expr';
54 \
Magento\Framework\
Data\Collection\AbstractDb $resourceCollection =
null,
58 $this->_runModelPath = $runModelPath;
59 $this->_configValueFactory = $configValueFactory;
71 $time = $this->
getData(
'groups/productalert_cron/fields/time/value');
72 $frequency = $this->
getData(
'groups/productalert_cron/fields/frequency/value');
77 $frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_MONTHLY ?
'1' :
'*',
79 $frequency == \Magento\Cron\Model\Config\Source\Frequency::CRON_WEEKLY ?
'1' :
'*',
82 $cronExprString = join(
' ', $cronExprArray);
85 $this->_configValueFactory->create()->load(
86 self::CRON_STRING_PATH,
91 self::CRON_STRING_PATH
93 $this->_configValueFactory->create()->load(
94 self::CRON_MODEL_PATH,
101 }
catch (\Exception $e) {
102 throw new \Exception(
__(
'We can\'t save the cron expression.'));
105 return parent::afterSave();
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList, \Magento\Framework\App\Config\ValueFactory $configValueFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, $runModelPath='', array $data=[])
getData($key='', $index=null)