本文整理汇总了PHP中XenForo_DataWriter::_preDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_DataWriter::_preDelete方法的具体用法?PHP XenForo_DataWriter::_preDelete怎么用?PHP XenForo_DataWriter::_preDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_DataWriter
的用法示例。
在下文中一共展示了XenForo_DataWriter::_preDelete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _preDelete
protected function _preDelete()
{
$db = $this->_db;
$formDestinationId = $this->get('form_destination_id');
$formDestinationIdQuoted = $db->quote($formDestinationId);
$db->delete('lpsf_form_destination_option', "form_destination_id = {$formDestinationIdQuoted}");
parent::_preDelete();
}
示例2: _preDelete
protected function _preDelete()
{
$db = $this->_db;
$formId = $this->get('form_id');
$formIdQuoted = $db->quote($formId);
$db->delete('lpsf_response_field', "field_id IN (SELECT field_id FROM lpsf_field WHERE form_id = {$formIdQuoted})");
$db->delete('lpsf_response', "form_id = {$formIdQuoted}");
$db->delete('lpsf_form_destination_option', "form_destination_id IN (SELECT form_destination_id FROM lpsf_form_destination WHERE form_id = {$formIdQuoted})");
$db->delete('lpsf_form_destination', "form_id = {$formIdQuoted}");
$db->delete('lpsf_field', "form_id = {$formIdQuoted}");
parent::_preDelete();
}
示例3: _preDelete
protected function _preDelete()
{
$db = $this->_db;
$responseId = $this->get('response_id');
$responseIdQuoted = $db->quote($responseId);
$db->delete('lpsf_response_field', "response_id = {$responseIdQuoted}");
parent::_preDelete();
}
示例4: _preDelete
/**
* Pre-delete behaviors.
*/
protected function _preDelete()
{
$db = $this->_db;
$options = XenForo_Application::getOptions();
// unassociate global field
if ($this->get('type') == 'global') {
$fieldModel = new LiquidPro_SimpleForms_Model_Field();
$associatedFields = $fieldModel->getFields(array('parent_field_id' => $this->get('field_id')));
switch ($options->deleteGlobalFieldsHandling) {
// delete all the associated fields
case 'delete':
foreach ($associatedFields as $associatedFieldId => $associatedField) {
$quotedFieldId = $db->quote($associatedFieldId);
// delete the responses for that field
$db->delete('lpsf_response_field', "field_id = {$quotedFieldId}");
// delete the field
$db->delete('lpsf_field', "field_id = {$quotedFieldId}");
}
break;
// convert all the associated fields to user fields
// convert all the associated fields to user fields
case 'convert':
foreach ($associatedFields as $associatedFieldId => $associatedField) {
$dw = new LiquidPro_SimpleForms_DataWriter_Field();
$dw->setExistingData($associatedField, true);
// unassociate from the global field
$dw->set('parent_field_id', null);
// override global settings
$dw->set('field_name', $this->get('field_name'));
$dw->set('field_type', $this->get('field_type'));
$dw->set('field_choices', $this->get('field_choices'));
$dw->set('match_type', $this->get('match_type'));
$dw->set('match_regex', $this->get('match_regex'));
$dw->set('match_callback_class', $this->get('match_callback_class'));
$dw->set('match_callback_method', $this->get('match_callback_method'));
$dw->set('max_length', $this->get('max_length'));
$dw->set('hide_title', $this->get('hide_title'));
$dw->set('default_value', $this->get('default_value'));
$dw->set('placeholder', $this->get('placeholder'));
$dw->set('min_length', $this->get('min_length'));
$dw->set('pre_text', $this->get('pre_text'));
$dw->set('post_text', $this->get('post_text'));
// save the associated field
$dw->save();
}
break;
// prevent the field from being deleted
// prevent the field from being deleted
case 'prevent':
if (count($associatedFields) > 0) {
$this->error(new XenForo_Phrase('fields_associated_with_global_field'));
}
break;
}
}
$fieldId = $this->get('field_id');
$fieldIdQuoted = $db->quote($fieldId);
$db->delete('lpsf_response_field', "field_id = {$fieldIdQuoted}");
parent::_preDelete();
}