33 \
Magento\Framework\Stdlib\DateTime\DateTime $date,
47 $this->
_init(
'newsletter_template',
'template_id');
63 'template_id = :template_id' 66 $countOfQueue = $this->
getConnection()->fetchOne(
$select, [
'template_id' => $template->getId()]);
68 return $countOfQueue > 0;
87 'template_code' =>
$template->getTemplateCode(),
88 'template_actual' => 1,
94 'template_id != :template_id' 96 'template_code = :template_code' 98 'template_actual = :template_actual' 103 return $countOfCodes > 0;
119 throw new \Magento\Framework\Exception\LocalizedException(
__(
'Duplicate template code'));
122 if (!$object->hasTemplateActual()) {
123 $object->setTemplateActual(1);
125 if (!$object->hasAddedAt()) {
126 $object->setAddedAt($this->_date->gmtDate());
128 $object->setModifiedAt($this->_date->gmtDate());
130 return parent::_beforeSave($object);
elseif(isset( $params[ 'redirect_parent']))
checkUsageInQueue(\Magento\Newsletter\Model\Template $template)
_init($mainTable, $idFieldName)
__construct(\Magento\Framework\Model\ResourceModel\Db\Context $context, \Magento\Framework\Stdlib\DateTime\DateTime $date, $connectionName=null)
_beforeSave(\Magento\Framework\Model\AbstractModel $object)
checkCodeUsage(\Magento\Newsletter\Model\Template $template)