__construct()
bulkSet()
create()
delete()
error()
get()
getError()
getErrors()
getExisting()
getExtraData()
getFieldNames()
getMergedData()
getMergedExistingData()
getMergedNewData()
getModelFromCache()
getNew()
getNewData()
getOption()
getTablesDataFromArray()
getUpdateCondition()
hasChanges()
hasErrors()
isChanged()
isExtraDataSet()
isInsert()
isUpdate()
mergeErrors()
preDelete()
preSave()
save()
set()
setDefaultSetOptions()
setErrorHandler()
setExistingData()
setExtraData()
setImportMode()
setOption()
updateVersionId()
_applyFieldValueLimits()
_beginDbTransaction()
_castValueToType()
_checkRequiredFieldsForUpdate()
_commitDbTransaction()
_delete()
_deleteMasterPhrase()
_getAdminSearchModel()
_getAlertModel()
_getAutoIncrementField()
_getCache()
_getDefaultOptions()
_getExistingData()
_getExistingPrimaryKey()
_getFields()
_getNewsFeedModel()
_getPhraseModel()
_getPrimaryTable()
_getSmilieModel()
_getSpecificRequiredFieldErrorText()
_getTableList()
_getUpdateCondition()
_getUserIgnoreModel()
_getUserModel()
_haveErrorsPreventSave()
_insert()
_insertOrUpdateMasterPhrase()
_isFieldValueValid()
_performLanguageRebuild()
_postDelete()
_postSave()
_postSaveAfterTransaction()
_preDelete()
_preSave()
_preSaveDefaults()
_rebuildSmilieCache()
_renameMasterPhrase()
_resolveDefaultsAndRequiredFieldsForInsert()
_rollbackDbTransaction()
_runVerificationCallback()
_save()
_setAutoIncrementValue()
_setInternal()
_setPostSave()
_triggerInvalidExistingDataError()
_triggerRequiredFieldError()
_update()
_verifySmilieText()
$_cache
$_db
$_errorHandler
$_errors
$_existingData
$_existingDataErrorPhrase
$_extraData
$_fields
$_importMode
$_modelCache
$_newData
$_options
$_preDeleteCalled
$_preSaveCalled
$_setOptions
$_triggerLanguageRebuild
ERROR_ARRAY
ERROR_EXCEPTION
ERROR_SILENT
TYPE_BINARY
TYPE_BOOLEAN
TYPE_FLOAT
TYPE_INT
TYPE_JSON
TYPE_SERIALIZED
TYPE_STRING
TYPE_UINT
TYPE_UINT_FORCED
TYPE_UNKNOWN
Data writer for smilies
Data writers focus on writing a unit of data to the database, including verifying all data to the application rules (including those set by the owner) and doing denormalized updates as necessary.
The writer may also interact with the cache, if required.
package | XenForo_Smilie |
---|
__construct(\constant $errorHandler, array $inject)
inherited_from | \XenForo_DataWriter::__construct() |
---|
\constant
Error handler. See {@link ERROR_EXCEPTION} and related.
array
null
Dependency injector. Array keys available: db, cache.
bulkSet(array $fields, array $options)
inherited_from | \XenForo_DataWriter::bulkSet() |
---|
array
Key-value pairs of fields and values.
array
Options to pass into {@link set()}. See {@link $_setOptions}.
create(string $class, \constant $errorHandler, array $inject) : \XenForo_DataWriter
The class must exist or be autoloadable or an exception will be thrown.
inherited_from | \XenForo_DataWriter::create() |
---|
string
Class to load
\constant
Error handler. See {@link ERROR_EXCEPTION} and related.
array
null
Dependencies to inject. See {@link __construct()}.
delete() : boolean
inherited_from | \XenForo_DataWriter::delete() |
---|
boolean
True on successerror(string | \XenForo_Phrase $error, string | false $errorKey, boolean $specificError)
Depending on the type of error handler chosen, this may throw an exception.
inherited_from | \XenForo_DataWriter::error() |
---|
string
false
Unique key for the error. Used to prevent multiple errors from the same field being displayed.
boolean
If true and error key specified, overwrites an existing error with this name
get(string $field, string $tableName) : mixed
inherited_from | \XenForo_DataWriter::get() |
---|
string
Field name
string
Table name, if empty loops through tables until first match
mixed
Returns null if the specified field could not be found.getError(string $errorKey) : string
inherited_from | \XenForo_DataWriter::getError() |
---|
string
string
getErrors() : array
getExisting(string $field, string $tableName) : mixed
Returns null if not set.
inherited_from | \XenForo_DataWriter::getExisting() |
---|
string
Field name
string
Table name, if empty loops through tables until first match
mixed
getExtraData(string $name) : mixed
inherited_from | \XenForo_DataWriter::getExtraData() |
---|
string
mixed
getFieldNames($tableName)
inherited_from | \XenForo_DataWriter::getFieldNames() |
---|
getMergedData(string $tableName) : array
This will generally reflect what is in the database.
If no table is specified, all data will be flattened into one array. New data takes priority over existing data, and earlier tables in the list take priority over later tables.
inherited_from | \XenForo_DataWriter::getMergedData() |
---|
string
array
getMergedExistingData(string $tableName) : array
inherited_from | \XenForo_DataWriter::getMergedExistingData() |
---|
string
array
getMergedNewData(string $tableName)
inherited_from | \XenForo_DataWriter::getMergedNewData() |
---|
string
getModelFromCache(string $class) : \XenForo_Model
If it does not exist, it will be instantiated.
inherited_from | \XenForo_DataWriter::getModelFromCache() |
---|
string
Name of the class to load
getNew(string $field, string $tableName) : mixed
Returns null if not set.
inherited_from | \XenForo_DataWriter::getNew() |
---|
string
Field name
string
Table name, if empty loops through tables until first match
mixed
getNewData() : array
inherited_from | \XenForo_DataWriter::getNewData() |
---|
array
getOption(string $name) : mixed
The meaning of this option is completely domain specific. If an unknown option specified, an exception will be triggered.
inherited_from | \XenForo_DataWriter::getOption() |
---|
string
Name of the option to get
mixed
Value of the optiongetTablesDataFromArray(array $dataArray) : array
In order for this to work, the following must be true: 1) The input array must provide all data that this datawriter requires 2) There can be no overlapping field names in the tables that define this data, unless those fields all store the same value 3) IMPORTANT: If the input array does not include all the required data fields, it is your responsibility to provide it after this function returns.
inherited_from | \XenForo_DataWriter::getTablesDataFromArray() |
---|
array
Complete data record
array
getUpdateCondition(string $tableName) : string
If there is no existing data, this always returns an empty string, otherwise it proxies to _getUpdateCondition(), which is an abstract function.
inherited_from | \XenForo_DataWriter::getUpdateCondition() |
---|
string
Name of the table to fetch the condition for
string
hasChanges() : boolean
inherited_from | \XenForo_DataWriter::hasChanges() |
---|
boolean
hasErrors() : boolean
inherited_from | \XenForo_DataWriter::hasErrors() |
---|
boolean
isChanged(string $field, string $tableName) : boolean
inherited_from | \XenForo_DataWriter::isChanged() |
---|
string
Field name
string
Table name, if empty loops through tables until first match
boolean
isExtraDataSet(string $name) : boolean
inherited_from | \XenForo_DataWriter::isExtraDataSet() |
---|
string
boolean
isInsert() : boolean
inherited_from | \XenForo_DataWriter::isInsert() |
---|
boolean
isUpdate() : boolean
inherited_from | \XenForo_DataWriter::isUpdate() |
---|
boolean
mergeErrors(array $errors)
inherited_from | \XenForo_DataWriter::mergeErrors() |
---|
array
preDelete()
Any verification or complex defaults may be set by this.
It is generally not advisable to override this function. If you just want to add pre-delete behaviors, override _preDelete().
inherited_from | \XenForo_DataWriter::preDelete() |
---|
preSave()
Any verification or complex defaults may be set by this.
It is generally not advisable to override this function. If you just want to add pre-save behaviors, override _preSave().
inherited_from | \XenForo_DataWriter::preSave() |
---|
save() : boolean
This either updates an existing record or inserts a new one, depending whether setExistingData was called.
After a successful insert with an auto_increment field, the value will be stored into the new data array with a field marked as autoIncrement. Use get() to get access to it.
inherited_from | \XenForo_DataWriter::save() |
---|
boolean
True on successset(string $field, string $value, string $tableName, array $options) : boolean
This value will be updated when save is called.
inherited_from | \XenForo_DataWriter::set() |
---|
string
Name of field to update
string
Value to update with
string
Table name, if empty then all tables with that column
array
Options. See {@link $_setOptions).
boolean
setDefaultSetOptions(array $setOptions)
See $_setOptions for the available options.
inherited_from | \XenForo_DataWriter::setDefaultSetOptions() |
---|
array
setErrorHandler(integer $errorHandler)
inherited_from | \XenForo_DataWriter::setErrorHandler() |
---|
integer
setExistingData(mixed $data, boolean $trustInputAsPrimary) : boolean
This causes the system to do an update instead of an insert. This function triggers an error if no data can be fetched from the provided data.
inherited_from | \XenForo_DataWriter::setExistingData() |
---|
mixed
Data that can uniquely ID this item
boolean
If true, trust the passed data to be based on data in DB; if false, the data is used as is (if it's an array)
boolean
setExtraData(string $name, mixed $value)
The DW should be able to function without this data.
inherited_from | \XenForo_DataWriter::setExtraData() |
---|
string
Name of the data
mixed
Value of the data
setImportMode($mode)
When enabled, preSave, postSave, and verification functions are disabled.
inherited_from | \XenForo_DataWriter::setImportMode() |
---|
boolean$mode
setOption(string $name, mixed $value)
The meaning of this option is completely domain specific. If an unknown option specified, an exception will be triggered.
inherited_from | \XenForo_DataWriter::setOption() |
---|
string
Name of the option to set
mixed
Value of the option
updateVersionId(string $versionIdField, string $versionStringField, string $addOnIdField) : integer
Th add-on ID is determined from a previously set value, so it should not be updated after this is called.
inherited_from | \XenForo_DataWriter::updateVersionId() |
---|
string
Name of the field the version ID will be written to
string
Name of the field where the version string will be written to
string
Name of the field the add-on ID is kept in
integer
Version ID to use_applyFieldValueLimits(string $fieldType, mixed $value, array $extraLimits) : boolean | string
Returns true if the field meets the constraints. The passed in value will be modified by reference.
inherited_from | \XenForo_DataWriter::_applyFieldValueLimits() |
---|
string
Type of the field. See the TYPE_* constants.
mixed
Value for the field.
array
Extra constraints
boolean
string
Either TRUE or an error message_beginDbTransaction()
inherited_from | \XenForo_DataWriter::_beginDbTransaction() |
---|
_castValueToType(string $fieldType, mixed $value, string $fieldName, array $fieldData) : mixed
inherited_from | \XenForo_DataWriter::_castValueToType() |
---|
string
Type to cast to
mixed
Value to cast
string
Name of the field being cast
array
Array of all field data information, for extra options
mixed
_checkRequiredFieldsForUpdate()
inherited_from | \XenForo_DataWriter::_checkRequiredFieldsForUpdate() |
---|
_commitDbTransaction()
inherited_from | \XenForo_DataWriter::_commitDbTransaction() |
---|
_delete()
Actually does the delete.
inherited_from | \XenForo_DataWriter::_delete() |
---|
_deleteMasterPhrase(string $title)
inherited_from | \XenForo_DataWriter::_deleteMasterPhrase() |
---|
string
_getAutoIncrementField(string $tableName) : string | false
This field is simply the first field tagged with the autoIncrement flag.
inherited_from | \XenForo_DataWriter::_getAutoIncrementField() |
---|
string
Name of the table to obtain the field for
string
false
Name of the field if found or false_getCache() : \Zend_Cache_Core | \Zend_Cache_Frontend | false
inherited_from | \XenForo_DataWriter::_getCache() |
---|
\Zend_Cache_Core
\Zend_Cache_Frontend
false
_getDefaultOptions() : array
This is automatically called in the constructor. If you wish to set options in your data writer, override this function. As this is handled at run time rather than compile time, you may use dynamic behaviors to set the option defaults.
inherited_from | \XenForo_DataWriter::_getDefaultOptions() |
---|
array
_getExistingData($data) : array | false
See parent for explanation.
mixed
array
false
_getExistingPrimaryKey(mixed $data, string $primaryKeyField, string $tableName) : string | false
inherited_from | \XenForo_DataWriter::_getExistingPrimaryKey() |
---|
mixed
Array of data containing the primary field or a scalar ID
string
Primary key field, if data is an array
string
Table name, if empty the first table defined in fields is used
string
false
_getFields() : array
See parent for explanation.
array
_getPrimaryTable() : string | false
inherited_from | \XenForo_DataWriter::_getPrimaryTable() |
---|
string
false
Name of the table or false_getSpecificRequiredFieldErrorText(string $tableName, string $field) : false | string | \XenForo_Phrase
Concrete DWs may override this to get nicer error messages for specific fields.
inherited_from | \XenForo_DataWriter::_getSpecificRequiredFieldErrorText() |
---|
string
string
_getTableList(string $tableName) : array
inherited_from | \XenForo_DataWriter::_getTableList() |
---|
string
Optional table to limit results to.
array
_getUpdateCondition(string $tableName) : string
_haveErrorsPreventSave() : boolean
If the silent error handler is used, errors simply trigger a return of true (yes, we have errors); otherwise, errors trigger an exception. Generally, if errors are to be handled, save shouldn't be called.
inherited_from | \XenForo_DataWriter::_haveErrorsPreventSave() |
---|
boolean
True if there are errors_insert()
inherited_from | \XenForo_DataWriter::_insert() |
---|
_insertOrUpdateMasterPhrase(string $title, string $text, string $addOnId, array $extra)
Errors will be silently ignored.
inherited_from | \XenForo_DataWriter::_insertOrUpdateMasterPhrase() |
---|
string
string
string
array
_isFieldValueValid(string $fieldName, array $fieldData, mixed $value, array $options) : boolean
The value may be modified based on type, contraints, or other verification methods.
inherited_from | \XenForo_DataWriter::_isFieldValueValid() |
---|
string
Name of the field.
array
Data about the field (includes type, contraints, callback, etc)
mixed
Value for the field
array
Options. Uses {@link $_setOptions}.
boolean
_performLanguageRebuild()
inherited_from | \XenForo_DataWriter::_performLanguageRebuild() |
---|
_postDelete()
_postSave()
This is not called in import mode.
_postSaveAfterTransaction()
This is not called in import mode.
inherited_from | \XenForo_DataWriter::_postSaveAfterTransaction() |
---|
_preDelete()
inherited_from | \XenForo_DataWriter::_preDelete() |
---|
_preSave()
This is not callbed in import mode.
inherited_from | \XenForo_DataWriter::_preSave() |
---|
_preSaveDefaults()
This is still called in import mode.
inherited_from | \XenForo_DataWriter::_preSaveDefaults() |
---|
_rebuildSmilieCache()
_renameMasterPhrase(string $oldName, string $newName)
If you get a conflict, it will be silently ignored.
inherited_from | \XenForo_DataWriter::_renameMasterPhrase() |
---|
string
string
_resolveDefaultsAndRequiredFieldsForInsert(boolean $checkRequired)
If a required field is not set properly, an error is thrown.
inherited_from | \XenForo_DataWriter::_resolveDefaultsAndRequiredFieldsForInsert() |
---|
boolean
If true, checks required fields
_rollbackDbTransaction()
inherited_from | \XenForo_DataWriter::_rollbackDbTransaction() |
---|
_runVerificationCallback(callback $callback, mixed $value, array $fieldData, $fieldName) : boolean
This callback may modify the value if it chooses to. Callback receives 2 params: the value and this object. The callback must return true if the value was valid.
Returns true if the verification was successful.
inherited_from | \XenForo_DataWriter::_runVerificationCallback() |
---|
callback
Callback to run. Use an array with a string '$this' to callback to this object.
mixed
Value to verify
array
Information about the field, including all constraints to be applied
boolean
_save()
Deals with both updates and inserts.
inherited_from | \XenForo_DataWriter::_save() |
---|
_setAutoIncrementValue(integer $insertId, string $tableName, bool $updateAll) : boolean
If the ID passed in is 0, nothing will be updated.
inherited_from | \XenForo_DataWriter::_setAutoIncrementValue() |
---|
integer
Auto-increment value from 0.
string
Name of the table set the auto increment field in
bool
Update all tables with cross referenced auto increment fields
boolean
True on update_setInternal(string $table, string $field, mixed $newValue, boolean $forceSet)
Use only when you're sure validation, etc isn't needed. The field will only be set if the value has changed.
inherited_from | \XenForo_DataWriter::_setInternal() |
---|
string
Table the field belongs to
string
Name of the field
mixed
Value for the field
boolean
If true, the set always goes through
_setPostSave(string $field, string $newValue, string $tableName, array $options) : boolean
inherited_from | \XenForo_DataWriter::_setPostSave() |
---|
string
Name of field to update
string
Value to update with
string
Table name, if empty then all tables with that column
array
Options. See {@link $_setOptions).
boolean
_triggerInvalidExistingDataError()
This can (and generally should) be extended by concrete DWs to give an error that is more specific to their content type.
inherited_from | \XenForo_DataWriter::_triggerInvalidExistingDataError() |
---|
_triggerRequiredFieldError(string $tableName, string $field)
inherited_from | \XenForo_DataWriter::_triggerRequiredFieldError() |
---|
string
string
_update()
inherited_from | \XenForo_DataWriter::_update() |
---|
_verifySmilieText(string $smilieText) : boolean
string
boolean
$_cache : \Zend_Cache_Core | \Zend_Cache_Frontend
inherited_from | \XenForo_DataWriter::$$_cache |
---|
$_db : \Zend_Db_Adapter_Abstract
inherited_from | \XenForo_DataWriter::$$_db |
---|
$_errorHandler : integer
See ERROR_EXCEPTION and related.
inherited_from | \XenForo_DataWriter::$$_errorHandler |
---|
$_errors : array
This is always populated when an error occurs, though an exception may be thrown as well.
inherited_from | \XenForo_DataWriter::$$_errors |
---|
$_existingData : array
This is only populated when updating a record.
inherited_from | \XenForo_DataWriter::$$_existingData |
---|
$_existingDataErrorPhrase : string
$_extraData : array
The DW should usually function without any data in this array. Any data that DW supports should be documented in this array, preferably by the use of constants.
Required data (for example, a related phrase) can be included here if necessary.
inherited_from | \XenForo_DataWriter::$$_extraData |
---|
$_fields : array
See _getFields() for more info.
inherited_from | \XenForo_DataWriter::$$_fields |
---|
$_importMode : boolean
To be used when using the DW for importing data in bulk. Note that you are responsible for manually replicating the post save effects.
inherited_from | \XenForo_DataWriter::$$_importMode |
---|
$_modelCache : array
This is now a static cache to allow data to be reused between data writers, as they are often used in bulk.
inherited_from | \XenForo_DataWriter::$$_modelCache |
---|
$_newData : array
inherited_from | \XenForo_DataWriter::$$_newData |
---|
$_preDeleteCalled : boolean
It can only be called once.
inherited_from | \XenForo_DataWriter::$$_preDeleteCalled |
---|
$_preSaveCalled : boolean
It can only be called once.
inherited_from | \XenForo_DataWriter::$$_preSaveCalled |
---|
$_setOptions : array
Available options are: (default value is listed in parentheses) * ignoreInvalidFields (false) - when true, an invalid field is simply ignored; otherwise an error is triggered * replaceInvalidWithDefault (false) - when true, invalid values are replaced with the default value (if there is one) * runVerificationCallback (true) - when true, verification callbacks are run when setting * setAfterPreSave (false) - when true, you may set data after preSave is called. This has very specific uses.
inherited_from | \XenForo_DataWriter::$$_setOptions |
---|
$_triggerLanguageRebuild : boolean
inherited_from | \XenForo_DataWriter::$$_triggerLanguageRebuild |
---|
ERROR_ARRAY : integer
Use this to push errors onto an array. If you try to save while there are errors, an exception will be thrown.
inherited_from | \XenForo_DataWriter::ERROR_ARRAY |
---|
ERROR_EXCEPTION : integer
Use this to trigger an exception when an error occurs.
inherited_from | \XenForo_DataWriter::ERROR_EXCEPTION |
---|
ERROR_SILENT : integer
Use this to push errors onto an array. If you try to save while there are errors, the save will silently fail. Use this in places where you aren't interested in handling errors.
inherited_from | \XenForo_DataWriter::ERROR_SILENT |
---|
TYPE_BINARY : string
Use this for binary or ASCII-only fields. Limits will refer to bytes.
inherited_from | \XenForo_DataWriter::TYPE_BINARY |
---|
TYPE_BOOLEAN : string
Use this for 0/1 boolean integer fields.
inherited_from | \XenForo_DataWriter::TYPE_BOOLEAN |
---|
TYPE_FLOAT : string
Use this for float fields. Limits can be applied on the range of valid values.
inherited_from | \XenForo_DataWriter::TYPE_FLOAT |
---|
TYPE_INT : string
Use this for integer fields. Limits can be applied on the range of valid values.
inherited_from | \XenForo_DataWriter::TYPE_INT |
---|
TYPE_JSON : string
inherited_from | \XenForo_DataWriter::TYPE_JSON |
---|
TYPE_SERIALIZED : string
Ensures that if the data is not a string, it is serialized to ne.
inherited_from | \XenForo_DataWriter::TYPE_SERIALIZED |
---|
TYPE_STRING : string
Use this for string fields. String fields are assumed to be UTF-8 and limits will refer to characters.
inherited_from | \XenForo_DataWriter::TYPE_STRING |
---|
TYPE_UINT : string
Use this for unsigned integer fields. Negative values will always fail to be valid. Limits can be applied on the range of valid values.
inherited_from | \XenForo_DataWriter::TYPE_UINT |
---|
TYPE_UINT_FORCED : string
Use this for unsigned integer fields. This differs from TYPE_UINT in that negative values will be silently cast to 0. Limits can be applied on the range of valid values.
inherited_from | \XenForo_DataWriter::TYPE_UINT_FORCED |
---|
TYPE_UNKNOWN : string
Use this for fields that have a type that cannot be known statically. Use this sparingly, as you must write code to ensure that the value is a scalar before it is inserted into the DB. The behavior if you don't do this is not defined!
inherited_from | \XenForo_DataWriter::TYPE_UNKNOWN |
---|