Data writer for posts.
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.
Methods
Constructor.
__construct(\constant $errorHandler, array $inject)
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::__construct() |
Parameters
$errorHandler
\constant
Error handler. See {@link ERROR_EXCEPTION} and related.
$inject
array
null
Dependency injector. Array keys available: db, cache.
Helper method to bulk set values from an array.
bulkSet(array $fields, array $options)
Inherited
inherited_from |
\XenForo_DataWriter::bulkSet() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::bulkSet() |
Parameters
$fields
array
Key-value pairs of fields and values.
$options
array
Options to pass into {@link set()}. See {@link $_setOptions}.
Factory method to get the named data writer.
create(string $class, \constant $errorHandler, array $inject) : \XenForo_DataWriter
Inherited
The class must exist or be autoloadable
or an exception will be thrown.
inherited_from |
\XenForo_DataWriter::create() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::create() |
Parameters
$class
string
Class to load
$errorHandler
\constant
Error handler. See {@link ERROR_EXCEPTION} and related.
$inject
array
null
Dependencies to inject. See {@link __construct()}.
Returns
Deletes the record that was selected by a call to {@link setExistingData()}.
delete() : boolean
Inherited
inherited_from |
\XenForo_DataWriter::delete() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::delete() |
Returns
boolean
True on success
Returns true if the parent discussion has been deleted (instead of this).
discussionDeleted() : boolean
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::discussionDeleted() |
Returns
boolean
Trigger an error with the specified string (or phrase object).
error(string | \XenForo_Phrase $error, string | false $errorKey, boolean $specificError)
Inherited
Depending on the
type of error handler chosen, this may throw an exception.
inherited_from |
\XenForo_DataWriter::error() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::error() |
Parameters
$errorKey
string
false
Unique key for the error. Used to prevent multiple errors from the same field being displayed.
$specificError
boolean
If true and error key specified, overwrites an existing error with this name
Gets data related to this object regardless of where it is defined (new or old).
get(string $field, string $tableName) : mixed
Inherited
inherited_from |
\XenForo_DataWriter::get() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::get() |
Parameters
$tableName
string
Table name, if empty loops through tables until first match
Returns
mixed
Returns null if the specified field could not be found.
Gets the field name of the container this message belongs to.
getContainerKeyName() : string
Inherited
This may
be a discussion (eg, thread) or something more general (a user for profile posts).
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getContainerKeyName() |
Returns
string
Gets the content type for tables that contain multiple data types together.
getContentType() : string
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getContentType() |
Returns
string
Gets the data about the discussion this message is in.
getDiscussionData() : array | null
Inherited
This may use the
discussion data writer, or some other source if needed.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getDiscussionData() |
Returns
array
null
Gets the discussion data writer.
getDiscussionDataWriter() : \XenForo_DataWriter_Discussion | false
Inherited
Note that if the container value changes,
this cache will not be removed.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getDiscussionDataWriter() |
Returns
Gets the current value of the discussion message ID for this message.
getDiscussionMessageId() : integer
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getDiscussionMessageId() |
Returns
integer
The name of the discussion message primary key.
getDiscussionMessageKeyName() : string
Inherited
Must be an auto increment column.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getDiscussionMessageKeyName() |
Returns
string
The name of the table that holds this type of discussion message.
getDiscussionMessageTableName() : string
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getDiscussionMessageTableName() |
Returns
string
Gets the specific named error if reported.
getError(string $errorKey) : string
Inherited
inherited_from |
\XenForo_DataWriter::getError() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getError() |
Parameters
$errorKey
string
Returns
string
Gets all errors that have been triggered.
getErrors() : array
Inherited
If preSave() has been
called and this returns an empty array, a save() should go through.
inherited_from |
\XenForo_DataWriter::getErrors() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getErrors() |
Returns
array
Explictly gets data from the existing data array.
getExisting(string $field, string $tableName) : mixed
Inherited
Returns null if not set.
inherited_from |
\XenForo_DataWriter::getExisting() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getExisting() |
Parameters
$tableName
string
Table name, if empty loops through tables until first match
Returns
mixed
getFieldNames()
getFieldNames($tableName)
Inherited
inherited_from |
\XenForo_DataWriter::getFieldNames() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getFieldNames() |
Parameters
$tableName
Merges the new and existing data to show a "final" view of the data.
getMergedData(string $tableName) : array
Inherited
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() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getMergedData() |
Parameters
$tableName
string
Returns
array
Gets the existing data only into a flat view of the data.
getMergedExistingData(string $tableName) : array
Inherited
inherited_from |
\XenForo_DataWriter::getMergedExistingData() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getMergedExistingData() |
Parameters
$tableName
string
Returns
array
Gets all new data that has been set to date, merged through all tables.
getMergedNewData(string $tableName)
Inherited
inherited_from |
\XenForo_DataWriter::getMergedNewData() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getMergedNewData() |
Parameters
$tableName
string
Gets the specified model object from the cache.
getModelFromCache(string $class) : \XenForo_Model
Inherited
If it does not exist,
it will be instantiated.
inherited_from |
\XenForo_DataWriter::getModelFromCache() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getModelFromCache() |
Parameters
$class
string
Name of the class to load
Returns
Explictly gets data from the new data array.
getNew(string $field, string $tableName) : mixed
Inherited
Returns null if not set.
inherited_from |
\XenForo_DataWriter::getNew() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getNew() |
Parameters
$tableName
string
Table name, if empty loops through tables until first match
Returns
mixed
Gets all new data that has been set to date
getNewData() : array
Inherited
inherited_from |
\XenForo_DataWriter::getNewData() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getNewData() |
Returns
array
Gets an option.
getOption(string $name) : mixed
Inherited
The meaning of this option is completely domain specific.
If an unknown option specified, an exception will be triggered.
inherited_from |
\XenForo_DataWriter::getOption() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getOption() |
Parameters
$name
string
Name of the option to get
Returns
mixed
Value of the option
Splits a (complete) data record array into its constituent tables using the _fields array for use in _getExistingData
getTablesDataFromArray(array $dataArray) : array
Inherited
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() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getTablesDataFromArray() |
Parameters
$dataArray
array
Complete data record
Returns
array
External handler to get the SQL update/delete condition for this data.
getUpdateCondition(string $tableName) : string
Inherited
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() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::getUpdateCondition() |
Parameters
$tableName
string
Name of the table to fetch the condition for
Returns
string
Returns true if changes have been made to this data.
hasChanges() : boolean
Inherited
inherited_from |
\XenForo_DataWriter::hasChanges() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::hasChanges() |
Returns
boolean
Determines if this DW has errors.
hasErrors() : boolean
Inherited
inherited_from |
\XenForo_DataWriter::hasErrors() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::hasErrors() |
Returns
boolean
Determines whether the named field has been changed/set.
isChanged(string $field, string $tableName) : boolean
Inherited
inherited_from |
\XenForo_DataWriter::isChanged() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::isChanged() |
Parameters
$tableName
string
Table name, if empty loops through tables until first match
Returns
boolean
Returns true if this is the first message in a newly inserted discussion
isDiscussionFirstMessage() : boolean
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::isDiscussionFirstMessage() |
Returns
boolean
Returns true if this DW is inserting a record, rather than updating one.
isInsert() : boolean
Inherited
inherited_from |
\XenForo_DataWriter::isInsert() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::isInsert() |
Returns
boolean
Returns true if this DW is updating a record, rather than inserting one.
isUpdate() : boolean
Inherited
inherited_from |
\XenForo_DataWriter::isUpdate() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::isUpdate() |
Returns
boolean
Merges a set of errors into this DW.
mergeErrors(array $errors)
Inherited
inherited_from |
\XenForo_DataWriter::mergeErrors() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::mergeErrors() |
Parameters
$errors
array
Public facing handler for final verification before a delete.
preDelete()
Inherited
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() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::preDelete() |
Public facing handler for final verification before a save.
preSave()
Inherited
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() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::preSave() |
Saves the changes to the data.
save() : boolean
Inherited
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() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::save() |
Returns
boolean
True on success
Sets a field.
set(string $field, string $value, string $tableName, array $options) : boolean
Inherited
This value will be updated when save is called.
inherited_from |
\XenForo_DataWriter::set() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::set() |
Parameters
$field
string
Name of field to update
$value
string
Value to update with
$tableName
string
Table name, if empty then all tables with that column
$options
array
Options. See {@link $_setOptions).
Returns
boolean
Sets the default options for {@link set()}.
setDefaultSetOptions(array $setOptions)
Inherited
See $_setOptions for
the available options.
inherited_from |
\XenForo_DataWriter::setDefaultSetOptions() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::setDefaultSetOptions() |
Parameters
Sets the data writer for the discussion this message is in--or will be in.
setDiscussionDataWriter(\XenForo_DataWriter_Discussion $discussionDw, boolean $isInsert)
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::setDiscussionDataWriter() |
Parameters
$isInsert
boolean
True if $discussionDataWriter->isInsert()
Sets the error handler type.
setErrorHandler(integer $errorHandler)
Inherited
inherited_from |
\XenForo_DataWriter::setErrorHandler() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::setErrorHandler() |
Parameters
$errorHandler
integer
Sets the existing data.
setExistingData(mixed $data, boolean $trustInputAsPrimary) : boolean
Inherited
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() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::setExistingData() |
Parameters
$data
mixed
Data that can uniquely ID this item
$trustInputAsPrimary
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)
Returns
boolean
Sets the import mode.
setImportMode($mode)
Inherited
When enabled, preSave, postSave, and verification functions are disabled.
inherited_from |
\XenForo_DataWriter::setImportMode() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::setImportMode() |
Parameters
Sets an option.
setOption(string $name, mixed $value)
Inherited
If the IS_AUTOMATED option is specified, other options are
set instead.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::setOption() |
Parameters
$name
string
$value
mixed
Updates the version ID field for the specified record.
updateVersionId(string $versionIdField, string $versionStringField, string $addOnIdField) : integer
Inherited
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() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::updateVersionId() |
Parameters
$versionIdField
string
Name of the field the version ID will be written to
$versionStringField
string
Name of the field where the version string will be written to
$addOnIdField
string
Name of the field the add-on ID is kept in
Returns
integer
Version ID to use
Adjust the position list surrounding this message, when this message
has been put from a position that "counts" (removed or hidden).
_adjustPositionListForInsert()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_adjustPositionListForInsert() |
Adjust the position list surrounding this message, when this message
has been removed from a position that "counts" (removed or hidden).
_adjustPositionListForRemoval()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_adjustPositionListForRemoval() |
Pushes an alert to any members who have been quoted in this message.
_alertQuoted()
Applies value limits to a field based on type and other constraints.
_applyFieldValueLimits(string $fieldType, mixed $value, array $extraLimits) : boolean | string
Inherited
Returns true if the field meets the constraints. The passed in value will
be modified by reference.
inherited_from |
\XenForo_DataWriter::_applyFieldValueLimits() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_applyFieldValueLimits() |
Parameters
$fieldType
string
Type of the field. See the TYPE_* constants.
$value
mixed
Value for the field.
$extraLimits
array
Extra constraints
Returns
boolean
string
Either TRUE or an error message
Associates attachments with this message.
_associateAttachments(string $attachmentHash)
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_associateAttachments() |
Parameters
$attachmentHash
string
Starts a new database transaction.
_beginDbTransaction()
Inherited
inherited_from |
\XenForo_DataWriter::_beginDbTransaction() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_beginDbTransaction() |
Casts the field value based on the specified type (TYPE_* constants).
_castValueToType(string $fieldType, mixed $value, string $fieldName, array $fieldData) : mixed
Inherited
inherited_from |
\XenForo_DataWriter::_castValueToType() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_castValueToType() |
Parameters
$fieldType
string
Type to cast to
$value
mixed
Value to cast
$fieldName
string
Name of the field being cast
$fieldData
array
Array of all field data information, for extra options
Returns
mixed
Checks that the first message has a valid state.
_checkFirstMessageState()
Inherited
Normally,
the first message must always be visible. If a non-visible
first message is required, change the discussion.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_checkFirstMessageState() |
Checks whether the message is spam.
_checkMessageForSpam()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_checkMessageForSpam() |
Check that the contents of the message are valid, based on length, images, etc.
_checkMessageValidity()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_checkMessageValidity() |
Checks that required field values are still maintained on updates.
_checkRequiredFieldsForUpdate()
Inherited
inherited_from |
\XenForo_DataWriter::_checkRequiredFieldsForUpdate() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_checkRequiredFieldsForUpdate() |
Commits a new database transaction.
_commitDbTransaction()
Inherited
inherited_from |
\XenForo_DataWriter::_commitDbTransaction() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_commitDbTransaction() |
Internal handler for a delete action.
_delete()
Inherited
Actually does the delete.
inherited_from |
\XenForo_DataWriter::_delete() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_delete() |
Deletes the attachments associated with this message.
_deleteAttachments()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_deleteAttachments() |
Removes an already published news feed item
_deleteFromNewsFeed()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_deleteFromNewsFeed() |
Deletes this message from the search index.
_deleteFromSearchIndex()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_deleteFromSearchIndex() |
Deletes the IP entry for this content.
_deleteIp()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_deleteIp() |
Delete all like entries for content.
_deleteLikes()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_deleteLikes() |
Deletes the named master phrase if it exists.
_deleteMasterPhrase(string $title)
Inherited
inherited_from |
\XenForo_DataWriter::_deleteMasterPhrase() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_deleteMasterPhrase() |
Parameters
$title
string
Determine if messages posted in the containing forum count towards the
user message count.
_forumCountsMessages() : boolean
Returns the admin search model
_getAdminSearchModel() : \XenForo_Model_AdminSearch
Inherited
inherited_from |
\XenForo_DataWriter::_getAdminSearchModel() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_getAdminSearchModel() |
Returns
Returns the alert model
_getAlertModel() : \XenForo_Model_Alert
Inherited
inherited_from |
\XenForo_DataWriter::_getAlertModel() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_getAlertModel() |
Returns
Finds the auto-increment field in the list of fields.
_getAutoIncrementField(string $tableName) : string | false
Inherited
This field is simply
the first field tagged with the autoIncrement flag.
inherited_from |
\XenForo_DataWriter::_getAutoIncrementField() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_getAutoIncrementField() |
Parameters
$tableName
string
Name of the table to obtain the field for
Returns
string
false
Name of the field if found or false
Helper method to get the cache object.
_getCache() : \Zend_Cache_Core | \Zend_Cache_Frontend | false
Inherited
inherited_from |
\XenForo_DataWriter::_getCache() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_getCache() |
Returns
\Zend_Cache_Core
\Zend_Cache_Frontend
false
Gets the fields that are defined for the table.
_getCommonFields() : array
Inherited
See parent for explanation.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_getCommonFields() |
Returns
array
Gets the default set of options for this data writer.
_getDefaultOptions() : array
Inherited
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_DiscussionMessage::_getDefaultOptions() |
Returns
array
Gets the actual existing data out of data that was passed in.
_getExistingData($data) : array | false
See parent for explanation.
Parameters
Returns
array
false
Get the primary key from either an array of data or just the scalar value
_getExistingPrimaryKey(mixed $data, string $primaryKeyField, string $tableName) : string | false
Inherited
inherited_from |
\XenForo_DataWriter::_getExistingPrimaryKey() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_getExistingPrimaryKey() |
Parameters
$data
mixed
Array of data containing the primary field or a scalar ID
$primaryKeyField
string
Primary key field, if data is an array
$tableName
string
Table name, if empty the first table defined in fields is used
Returns
string
false
Gets the fields that are defined for the table.
_getFields() : array
See parent for explanation.
Returns
array
Returns the news feed model
_getNewsFeedModel() : \XenForo_Model_NewsFeed
Inherited
inherited_from |
\XenForo_DataWriter::_getNewsFeedModel() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_getNewsFeedModel() |
Returns
Returns the phrase model
_getPhraseModel() : \XenForo_Model_Phrase
Inherited
inherited_from |
\XenForo_DataWriter::_getPhraseModel() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_getPhraseModel() |
Returns
_getPostModel()
_getPostModel() : \XenForo_Model_Post
Finds the first table in the _fields array
_getPrimaryTable() : string | false
Inherited
inherited_from |
\XenForo_DataWriter::_getPrimaryTable() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_getPrimaryTable() |
Returns
string
false
Name of the table or false
Gets the error text (or phrase) for a specific required field.
_getSpecificRequiredFieldErrorText(string $tableName, string $field) : false | string | \XenForo_Phrase
Inherited
Concrete DWs
may override this to get nicer error messages for specific fields.
inherited_from |
\XenForo_DataWriter::_getSpecificRequiredFieldErrorText() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_getSpecificRequiredFieldErrorText() |
Parameters
$tableName
string
$field
string
Returns
Gets an array with a list of all table names or, if provided, only
the specified table.
_getTableList(string $tableName) : array
Inherited
inherited_from |
\XenForo_DataWriter::_getTableList() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_getTableList() |
Parameters
$tableName
string
Optional table to limit results to.
Returns
array
Gets SQL condition to update the existing record.
_getUpdateCondition(string $tableName) : string
Inherited
Should read from _existingData.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_getUpdateCondition() |
Parameters
$tableName
string
Table name
Returns
string
_getUserIgnoreModel()
_getUserIgnoreModel() : \XenForo_Model_UserIgnore
Inherited
inherited_from |
\XenForo_DataWriter::_getUserIgnoreModel() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_getUserIgnoreModel() |
Returns
Returns the user model
_getUserModel() : \XenForo_Model_User
Inherited
inherited_from |
\XenForo_DataWriter::_getUserModel() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_getUserModel() |
Returns
Determines if we have errors that would prevent a save.
_haveErrorsPreventSave() : boolean
Inherited
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() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_haveErrorsPreventSave() |
Returns
boolean
True if there are errors
Updates the search index for this message.
_indexForSearch()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_indexForSearch() |
Internal save handler.
_insert()
Inherited
inherited_from |
\XenForo_DataWriter::_insert() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_insert() |
Inserts or updates a master (language 0) phrase.
_insertOrUpdateMasterPhrase(string $title, string $text, string $addOnId, array $extra)
Inherited
Errors will be silently ignored.
inherited_from |
\XenForo_DataWriter::_insertOrUpdateMasterPhrase() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_insertOrUpdateMasterPhrase() |
Parameters
$title
string
$text
string
$addOnId
string
$extra
array
Inserts or updates a record in the search index for this message.
_insertOrUpdateSearchIndex()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_insertOrUpdateSearchIndex() |
Determines if the provided value for a field is valid.
_isFieldValueValid(string $fieldName, array $fieldData, mixed $value, array $options) : boolean
Inherited
The value may be
modified based on type, contraints, or other verification methods.
inherited_from |
\XenForo_DataWriter::_isFieldValueValid() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_isFieldValueValid() |
Parameters
$fieldName
string
Name of the field.
$fieldData
array
Data about the field (includes type, contraints, callback, etc)
$value
mixed
Value for the field
$options
array
Options. Uses {@link $_setOptions}.
Returns
boolean
Designed to be overridden by child classes
_messagePostDelete()
Designed to be overridden by child classes
_messagePostSave()
Designed to be overridden by child classes
_messagePreDelete()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_messagePreDelete() |
Designed to be overridden by child classes
_messagePreSave()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_messagePreSave() |
Generic discussion message post-delete handler.
_postDelete()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_postDelete() |
Generic discussion message post-save handler.
_postSave()
Inherited
This is not called in import mode.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_postSave() |
Post-save handling, after the transaction is committed.
_postSaveAfterTransaction()
This is not called in
import mode.
Generic discussion message pre-delete handler.
_preDelete()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_preDelete() |
Generic discussion message pre-save handler.
_preSave()
Inherited
This
is not callbed in import mode.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_preSave() |
Method designed to be overridden by child classes to add pre-save behaviors that
set dynamic defaults.
_preSaveDefaults()
Inherited
This is still called in import mode.
inherited_from |
\XenForo_DataWriter::_preSaveDefaults() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_preSaveDefaults() |
Called during post-save, handles publishing to news feed
and sending notifications
_publishAndNotify()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_publishAndNotify() |
Publishes an insert or update event to the news feed
_publishToNewsFeed()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_publishToNewsFeed() |
Renames a master phrase.
_renameMasterPhrase(string $oldName, string $newName)
Inherited
If you get a conflict, it will
be silently ignored.
inherited_from |
\XenForo_DataWriter::_renameMasterPhrase() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_renameMasterPhrase() |
Parameters
$oldName
string
$newName
string
This resolves unset fields to their defaults (if available) and the checks
for required fields that are unset or empty.
_resolveDefaultsAndRequiredFieldsForInsert(boolean $checkRequired)
Inherited
If a required field is not
set properly, an error is thrown.
inherited_from |
\XenForo_DataWriter::_resolveDefaultsAndRequiredFieldsForInsert() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_resolveDefaultsAndRequiredFieldsForInsert() |
Parameters
$checkRequired
boolean
If true, checks required fields
Rolls a database transaction back.
_rollbackDbTransaction()
Inherited
inherited_from |
\XenForo_DataWriter::_rollbackDbTransaction() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_rollbackDbTransaction() |
Runs the verification callback.
_runVerificationCallback(callback $callback, mixed $value, array $fieldData, $fieldName) : boolean
Inherited
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() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_runVerificationCallback() |
Parameters
$callback
callback
Callback to run. Use an array with a string '$this' to callback to this object.
$value
mixed
Value to verify
$fieldData
array
Information about the field, including all constraints to be applied
$fieldName
Returns
boolean
Internal save handler.
_save()
Inherited
Deals with both updates and inserts.
inherited_from |
\XenForo_DataWriter::_save() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_save() |
Saves the discussion data writer if it exists and has changed.
_saveDiscussionDataWriter()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_saveDiscussionDataWriter() |
Sets the auto-increment value to the auto increment field, if there is one.
_setAutoIncrementValue(integer $insertId, string $tableName, bool $updateAll) : boolean
Inherited
If the ID passed in is 0, nothing will be updated.
inherited_from |
\XenForo_DataWriter::_setAutoIncrementValue() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_setAutoIncrementValue() |
Parameters
$insertId
integer
Auto-increment value from 0.
$tableName
string
Name of the table set the auto increment field in
$updateAll
bool
Update all tables with cross referenced auto increment fields
Returns
boolean
True on update
Internal function to set a field without any validation or type casting.
_setInternal(string $table, string $field, mixed $newValue, boolean $forceSet)
Inherited
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() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_setInternal() |
Parameters
$table
string
Table the field belongs to
$field
string
Name of the field
$newValue
mixed
Value for the field
$forceSet
boolean
If true, the set always goes through
Sets the message's position within the discussion.
_setPosition()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_setPosition() |
Internal helper for calling set after save and not triggering an error.
_setPostSave(string $field, string $newValue, string $tableName, array $options) : boolean
Inherited
inherited_from |
\XenForo_DataWriter::_setPostSave() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_setPostSave() |
Parameters
$field
string
Name of field to update
$newValue
string
Value to update with
$tableName
string
Table name, if empty then all tables with that column
$options
array
Options. See {@link $_setOptions).
Returns
boolean
Triggers the error for when invalid existing data was requested.
_triggerInvalidExistingDataError()
Inherited
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() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_triggerInvalidExistingDataError() |
Triggers the error for a required field not being specified.
_triggerRequiredFieldError(string $tableName, string $field)
Inherited
inherited_from |
\XenForo_DataWriter::_triggerRequiredFieldError() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_triggerRequiredFieldError() |
Parameters
$tableName
string
$field
string
Internal update handler.
_update()
Inherited
inherited_from |
\XenForo_DataWriter::_update() |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_update() |
Updates the deletion log if necessary.
_updateDeletionLog()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_updateDeletionLog() |
Updates data in the discussion after the message is deleted.
_updateDiscussionPostDelete()
Inherited
This may cause the entire discussion to be deleted.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_updateDiscussionPostDelete() |
Updates the discussion container info.
_updateDiscussionPostSave()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_updateDiscussionPostSave() |
Upates the IP data.
_updateIpData()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_updateIpData() |
Updates the position list based on state changes.
_updateMessagePositionList()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_updateMessagePositionList() |
Updates the moderation queue if necessary.
_updateModerationQueue()
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_updateModerationQueue() |
Updates the user like count.
_updateUserLikeCount(boolean $isDelete)
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::_updateUserLikeCount() |
Parameters
$isDelete
boolean
True if hard deleting the message
Checks that the messages posted in the containing forum count towards the
user message count before running the standard message count update.
_updateUserMessageCount(boolean $isDelete)
see |
\global\XenForo_DataWriter_DiscussionMessage::_updateUserMessageCount() |
Parameters
$isDelete
boolean
True if hard deleting the message
Properties
Cache object
$_cache : \Zend_Cache_Core | \Zend_Cache_Frontend
Inherited
inherited_from |
\XenForo_DataWriter::$$_cache |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_cache |
Database object
$_db : \Zend_Db_Adapter_Abstract
Inherited
inherited_from |
\XenForo_DataWriter::$$_db |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_db |
Default value for the change user message count option.
$_defaultChangeUserMessageCount : boolean
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_defaultChangeUserMessageCount |
Reflects important changes to the parent discussion.
$_discussionChange : string
Inherited
Current values:
* [empty] - no change of value
* delete - discussion has been deleted
* firstDelete - first message has been deleted, restructure has been carried out
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_discussionChange |
The discussion data writer.
$_discussionDw : \XenForo_DataWriter_Discussion
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_discussionDw |
The insert/update mode of the discussion data writer
$_discussionMode : string
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_discussionMode |
Type of error handler.
$_errorHandler : integer
Inherited
See ERROR_EXCEPTION and related.
inherited_from |
\XenForo_DataWriter::$$_errorHandler |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_errorHandler |
Array of errors.
$_errors : array
Inherited
This is always populated when an error occurs, though
an exception may be thrown as well.
inherited_from |
\XenForo_DataWriter::$$_errors |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_errors |
Existing data in the database.
$_existingData : array
Inherited
This is only populated when updating a record.
inherited_from |
\XenForo_DataWriter::$$_existingData |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_existingData |
Title of the phrase that will be created when a call to set the
existing data fails (when the data doesn't exist).
$_existingDataErrorPhrase : string
Inherited
inherited_from |
\XenForo_DataWriter::$$_existingDataErrorPhrase |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_existingDataErrorPhrase |
Array of valid fields in the table.
$_fields : array
Inherited
See _getFields() for more info.
inherited_from |
\XenForo_DataWriter::$$_fields |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_fields |
Identifies if a message has a parent discussion item.
$_hasParentDiscussion : boolean
Inherited
Must overload {@see getDiscussionDataWriter()} if set to true.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_hasParentDiscussion |
When enabled, preSave, postSave, and verification functions are disabled.
$_importMode : boolean
Inherited
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 |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_importMode |
Standard approach to caching model objects for the lifetime of the data writer.
$_modelCache : array
Inherited
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 |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_modelCache |
Data that has just been set an is about to be saved.
$_newData : array
Inherited
inherited_from |
\XenForo_DataWriter::$$_newData |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_newData |
Options that change the behavior of the data writer.
$_options : array
Inherited
All options that a
data writer supports must be documented in this array, preferably
by the use of constants.
inherited_from |
\XenForo_DataWriter::$$_options |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_options |
Tracks whether {@link _preDelete()} was called.
$_preDeleteCalled : boolean
Inherited
It can only be called once.
inherited_from |
\XenForo_DataWriter::$$_preDeleteCalled |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_preDeleteCalled |
Tracks whether {@link _preSave()} was called.
$_preSaveCalled : boolean
Inherited
It can only be called once.
inherited_from |
\XenForo_DataWriter::$$_preSaveCalled |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_preSaveCalled |
Options that can be passed into {@link set()}.
$_setOptions : array
Inherited
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 |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_setOptions |
If true, a language rebuild is triggered at the very end of a save/delete process.
$_triggerLanguageRebuild : boolean
Inherited
inherited_from |
\XenForo_DataWriter::$$_triggerLanguageRebuild |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::$$_triggerLanguageRebuild |
Constants
Holds the temporary hash used to pull attachments and associate them with this message.
DATA_ATTACHMENT_HASH : string
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::DATA_ATTACHMENT_HASH |
Holds the reason for soft deletion.
DATA_DELETE_REASON : string
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::DATA_DELETE_REASON |
Constant for error handling.
ERROR_ARRAY : integer
Inherited
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 |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::ERROR_ARRAY |
Constant for error handling.
ERROR_EXCEPTION : integer
Inherited
Use this to trigger an exception when an error occurs.
inherited_from |
\XenForo_DataWriter::ERROR_EXCEPTION |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::ERROR_EXCEPTION |
Constant for error handling.
ERROR_SILENT : integer
Inherited
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 |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::ERROR_SILENT |
Option that controls whether the posting user's message count will be
changed by posting this message.
OPTION_CHANGE_USER_MESSAGE_COUNT : string
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::OPTION_CHANGE_USER_MESSAGE_COUNT |
Option that controls whether we should check this message for spam.
OPTION_CHECK_SPAM : string
Inherited
This applies
to new messages only.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::OPTION_CHECK_SPAM |
Option that controls whether the discussion is removed if deleting the first message.
OPTION_DELETE_DISCUSSION_FIRST_MESSAGE : string
Inherited
Note that if the discussion only has the first message and it's deleted, it will always be removed.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::OPTION_DELETE_DISCUSSION_FIRST_MESSAGE |
Option that controls whether the data in this message should be indexed for
search.
OPTION_INDEX_FOR_SEARCH : string
Inherited
If this value is set inconsistently for the same message, data might
be orphaned in the search index.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::OPTION_INDEX_FOR_SEARCH |
Meta-option for discussion message submissions that are via automated means.
OPTION_IS_AUTOMATED
Inherited
Some dynamic checks are skipped (eg, message length and flood check), and
other data is ignored (eg, IP address).
inherited_from |
\XenForo_DataWriter_DiscussionMessage::OPTION_IS_AUTOMATED |
Maximum number of images allowed in a message.
OPTION_MAX_IMAGES : string
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::OPTION_MAX_IMAGES |
Option that controls the maximum number of characters that are allowed in
a message.
OPTION_MAX_MESSAGE_LENGTH : string
Inherited
inherited_from |
\XenForo_DataWriter_DiscussionMessage::OPTION_MAX_MESSAGE_LENGTH |
Option that controls whether this should be published in the news feed.
OPTION_PUBLISH_FEED : string
Inherited
Defaults to true.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::OPTION_PUBLISH_FEED |
Option that controls whether an IP address should be recorded for this message.
OPTION_SET_IP_ADDRESS : string
Inherited
Defaults to true.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::OPTION_SET_IP_ADDRESS |
Option that controls whether data in the parent discussion should be updated,
including reply counts and last post info.
OPTION_UPDATE_PARENT_DISCUSSION : string
Inherited
Defaults to true.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::OPTION_UPDATE_PARENT_DISCUSSION |
Option that controls whether a guest user name is checked to confirm that it
doesn't conflict with a valid user.
OPTION_VERIFY_GUEST_USERNAME : string
Inherited
Defaults to true.
inherited_from |
\XenForo_DataWriter_DiscussionMessage::OPTION_VERIFY_GUEST_USERNAME |
Constant for data fields.
TYPE_BINARY : string
Inherited
Use this for binary or ASCII-only fields. Limits
will refer to bytes.
inherited_from |
\XenForo_DataWriter::TYPE_BINARY |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::TYPE_BINARY |
Constant for data fields.
TYPE_BOOLEAN : string
Inherited
Use this for 0/1 boolean integer fields.
inherited_from |
\XenForo_DataWriter::TYPE_BOOLEAN |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::TYPE_BOOLEAN |
Constant for data fields.
TYPE_FLOAT : string
Inherited
Use this for float fields. Limits can be applied
on the range of valid values.
inherited_from |
\XenForo_DataWriter::TYPE_FLOAT |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::TYPE_FLOAT |
Constant for data fields.
TYPE_INT : string
Inherited
Use this for integer fields. Limits can be applied
on the range of valid values.
inherited_from |
\XenForo_DataWriter::TYPE_INT |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::TYPE_INT |
Data is serialized to JSON.
TYPE_JSON : string
Inherited
inherited_from |
\XenForo_DataWriter::TYPE_JSON |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::TYPE_JSON |
Data is serialized.
TYPE_SERIALIZED : string
Inherited
Ensures that if the data is not a string, it is serialized to ne.
inherited_from |
\XenForo_DataWriter::TYPE_SERIALIZED |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::TYPE_SERIALIZED |
Constant for data fields.
TYPE_STRING : string
Inherited
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 |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::TYPE_STRING |
Constant for data fields.
TYPE_UINT : string
Inherited
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 |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::TYPE_UINT |
Constant for data fields.
TYPE_UINT_FORCED : string
Inherited
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 |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::TYPE_UINT_FORCED |
Constant for data fields.
TYPE_UNKNOWN : string
Inherited
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 |
inherited_from |
\XenForo_DataWriter_DiscussionMessage::TYPE_UNKNOWN |