本文整理汇总了PHP中BackendModel::deleteExtra方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendModel::deleteExtra方法的具体用法?PHP BackendModel::deleteExtra怎么用?PHP BackendModel::deleteExtra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BackendModel
的用法示例。
在下文中一共展示了BackendModel::deleteExtra方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Delete an item.
*
* @return void
* @param int $id The id of the record to delete.
*/
public static function delete($id)
{
// redefine
$id = (int) $id;
// get db
$db = BackendModel::getDB(true);
// get field ids
$fieldIds = (array) $db->getColumn('SELECT i.id FROM forms_fields AS i WHERE i.form_id = ?', $id);
// we have items to be deleted
if (!empty($fieldIds)) {
// delete all fields
$db->delete('forms_fields', 'form_id = ?', $id);
$db->delete('forms_fields_validation', 'field_id IN(' . implode(',', $fieldIds) . ')');
}
// get data ids
$dataIds = (array) $db->getColumn('SELECT i.id FROM forms_data AS i WHERE i.form_id = ?', $id);
// we have items to be deleted
if (!empty($dataIds)) {
self::deleteData($dataIds);
}
// delete extra
BackendModel::deleteExtra('form_builder', 'widget', array('id' => $id));
// delete form
$db->delete('forms', 'id = ?', $id);
}