/** * Check for unique values existence * * @param Mage_Core_Model_Abstract $object * @return Mage_Core_Model_Resource_Db_Abstract * @throws Mage_Core_Exception */ protected function _checkUnique(Mage_Core_Model_Abstract $object) { $data = new Varien_Object($this->_prepareDataForSave($object)); $select = $this->_getWriteAdapter()->select()->from($this->getTable('mep/profile'))->where('filename' . '=?', trim($data->getData('filename')))->where('filepath' . '=?', trim($data->getData('filepath')))->where('id' . '!=?', trim($data->getData('id'))); if ($this->_getWriteAdapter()->fetchRow($select)) { Mage::throwException(Mage::helper('core')->__('There is already a Magento Profile with the Same Export Filename "%s" and Path ', $data->getData('filename'))); } return parent::_checkUnique($object); }
/** * Check for unique values existence * * @param Mage_Core_Model_Abstract $object * @return Mage_Core_Model_Resource_Db_Abstract * @throws Mage_Core_Exception */ protected function _checkUnique(Mage_Core_Model_Abstract $object) { $data = new Varien_Object($this->_prepareDataForSave($object)); $select = $this->_getWriteAdapter()->select()->from($this->getTable('eav/attribute'))->where('attribute_code' . '=?', trim($data->getData('attribute_code'))); if ($this->_getWriteAdapter()->fetchRow($select)) { Mage::throwException(Mage::helper('core')->__('There is already a Magento Attribute with the Code "%s".', $data->getData('attribute_code'))); } return parent::_checkUnique($object); }