1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-26 03:30:48 +03:00

Возможность удаления дополнительных полей

This commit is contained in:
Mzhelskiy Maxim 2014-02-06 14:32:50 +07:00
parent 10aa181a7e
commit 70f8fcbfaf
4 changed files with 99 additions and 0 deletions

View file

@ -750,4 +750,29 @@ class ModuleProperty extends ModuleORM {
}
return false;
}
public function RemoveValueByPropertyId($iPropertyId) {
$bRes=$this->oMapper->RemoveValueByPropertyId($iPropertyId);
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,array('ModuleProperty_EntityValue_delete'));
return $bRes;
}
public function RemoveValueTagByPropertyId($iPropertyId) {
$bRes=$this->oMapper->RemoveValueTagByPropertyId($iPropertyId);
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,array('ModuleProperty_EntityValueTag_delete'));
return $bRes;
}
public function RemoveValueSelectByPropertyId($iPropertyId) {
$bRes=$this->oMapper->RemoveValueSelectByPropertyId($iPropertyId);
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,array('ModuleProperty_EntityValueSelect_delete'));
return $bRes;
}
public function RemoveSelectByPropertyId($iPropertyId) {
$bRes=$this->oMapper->RemoveSelectByPropertyId($iPropertyId);
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,array('ModuleProperty_EntitySelect_delete'));
return $bRes;
}
}

View file

@ -94,6 +94,30 @@ class ModuleProperty_EntityProperty extends EntityORM {
}
return true;
}
/**
* Выполняется перед удалением сущности
*
* @return bool
*/
protected function beforeDelete() {
/**
* Сначала удаляем стандартные значения
*/
$this->Property_RemoveValueByPropertyId($this->getId());
/**
* Удаляем значения тегов
*/
$this->Property_RemoveValueTagByPropertyId($this->getId());
/**
* Удаляем значения селектов
*/
$this->Property_RemoveValueSelectByPropertyId($this->getId());
/**
* Удаляем сами варианты селектов
*/
$this->Property_RemoveSelectByPropertyId($this->getId());
return true;
}
/**
* Возвращает правила валидации поля
*

View file

@ -134,6 +134,54 @@ class ModuleProperty_MapperProperty extends Mapper {
return false;
}
public function RemoveValueByPropertyId($iPropertyId) {
$sql = "DELETE
FROM ".Config::Get('db.table.property_value')."
WHERE
property_id = ?d
";
if ($this->oDb->query($sql,$iPropertyId)!==false) {
return true;
}
return false;
}
public function RemoveValueTagByPropertyId($iPropertyId) {
$sql = "DELETE
FROM ".Config::Get('db.table.property_value_tag')."
WHERE
property_id = ?d
";
if ($this->oDb->query($sql,$iPropertyId)!==false) {
return true;
}
return false;
}
public function RemoveValueSelectByPropertyId($iPropertyId) {
$sql = "DELETE
FROM ".Config::Get('db.table.property_value_select')."
WHERE
property_id = ?d
";
if ($this->oDb->query($sql,$iPropertyId)!==false) {
return true;
}
return false;
}
public function RemoveSelectByPropertyId($iPropertyId) {
$sql = "DELETE
FROM ".Config::Get('db.table.property_select')."
WHERE
property_id = ?d
";
if ($this->oDb->query($sql,$iPropertyId)!==false) {
return true;
}
return false;
}
public function GetPropertyTagsByLike($sTag,$iPropertyId,$iLimit) {
$sTag=mb_strtolower($sTag,"UTF-8");
$sql = "SELECT

View file

@ -31,6 +31,7 @@ return array(
'empty' => 'Тут ничего нет',
'error' => array(
'save' => 'Ошибка сохранения',
'remove' => 'При удалении возникла ошибка',
'system' => array(
'code' => array(
'404' => 'К сожалению, такой страницы не существует. Вероятно, она была удалена с сервера, либо ее здесь никогда не было.',
@ -41,6 +42,7 @@ return array(
),
'success' => array(
'save' => 'Успешно сохранено',
'remove' => 'Удаление прошло успешно',
)
),