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