Ejemplo n.º 1
0
 /**
  * Validate email template code
  *
  * @throws \Magento\Framework\Mail\Exception
  * @return $this
  */
 protected function _beforeSave()
 {
     $code = $this->getTemplateCode();
     if (empty($code)) {
         throw new \Magento\Framework\Mail\Exception(__('The template Name must not be empty.'));
     }
     if ($this->_getResource()->checkCodeUsage($this)) {
         throw new \Magento\Framework\Mail\Exception(__('Duplicate Of Template Name'));
     }
     return parent::_beforeSave();
 }
Ejemplo n.º 2
0
 /**
  * Processing object before save data
  *
  * @return $this
  */
 protected function _beforeSave()
 {
     $this->validate();
     return parent::_beforeSave();
 }