示例#1
0
 protected function _preSave($is_new)
 {
     parent::_preSave($is_new);
     if ($is_new) {
         $this->_generateKey();
         if (array_key_exists($this->_key, self::getAll())) {
             throw new \Exception(framework\Context::getI18n()->__('This field key already exists'));
         }
     }
 }