__construct()
addFetchOptionJoin()
addPositionLimit()
assertValidCutOffOperator()
create()
deleteChildNodes()
fetchAllKeyed()
filterGroupedNodesToDepth()
filterNodeTypesInTree()
filterOrphanNodes()
getAllNodeTypes()
getAllNodeTypesFromDb()
getAllNodes()
getChildNodes()
getChildNodesForNodeIds()
getChildNodesToDepth()
getConditionsForClause()
getContentTypeField()
getContentTypesWithField()
getModelFromCache()
getNewNestedSetInfo()
getNodeAncestors()
getNodeBreadCrumbs()
getNodeById()
getNodeByName()
getNodeDataForListDisplay()
getNodeHandlersForNodeTypes()
getNodeHierarchy()
getNodeIdsFromNames()
getNodeOptionsArray()
getNodePermissionsForPermissionCombination()
getNodeTotalItemCounts()
getNodeTypeById()
getNodeTypeByNodeId()
getNodeTypeNameById()
getNodeTypeOptionsArray()
getNodeTypesGroupedByPermissionGroup()
getNodesForAdminQuickSearch()
getNodesToDepthFromRoot()
getOrderByClause()
getPossibleParentNodes()
getRootNode()
getSiblingNodes()
getUniqueNodeTypeIdsFromNodeList()
getViewableNodeList()
getViewableNodesFromNodeList()
groupNodesByParent()
hasChildNodes()
limitQueryResults()
mergeExtraNodeDataIntoNodeList()
mergePushableNodeData()
moveChildNodes()
prepareLimitFetchOptions()
prepareNodeForAdmin()
prepareNodesForAdmin()
prepareNodesWithHandlers()
prepareStateLimitFromConditions()
pushNodeDataUpTree()
rebuildNodeTypeCache()
resetLocalCacheData()
setAllowCachedRead()
setLocalCacheData()
standardizeNodePermissionsAndUserId()
standardizePermissionCombinationIdAndUserId()
standardizePermissionsAndUserId()
standardizeViewingUserReference()
standardizeViewingUserReferenceForNode()
unserializePermissionsInList()
updateNestedSetInfo()
_getCache()
_getDataRegistryModel()
_getDb()
_getLocalCacheData()
_isNode()
_isNodeHierarchy()
_isNodesArray()
$_allowCachedRead
$_cache
$_db
$_localCacheData
$_modelCache
Base class for models.
Models don't share that much, so most implementations will be adding methods onto this class. This class simply provides helper methods for common actions.
package | XenForo_Mvc |
---|
__construct()
Use create() statically unless you know what you're doing.
inherited_from | \XenForo_Model::__construct() |
---|
addFetchOptionJoin(array $fetchOptions, integer $join)
Join should be one of the constants.
inherited_from | \XenForo_Model::addFetchOptionJoin() |
---|
array
integer
addPositionLimit(string $table, integer $limit, integer $offset, string $column) : string
It no limit value is specified, nothing will be returned.
This must be added within a WHERE clause. If a clause is required, it will begin with "AND", so ensure there is a condition before it.
inherited_from | \XenForo_Model::addPositionLimit() |
---|
string
Name of the table alias to prefix. May be blank for no table reference.
integer
Number of records to limit to; ignored if <= 0
integer
Offset from the start of the records. 0+
string
Name of the column that is storing the position
string
Position limit clause if neededassertValidCutOffOperator(string $operator)
inherited_from | \XenForo_Model::assertValidCutOffOperator() |
---|
string
create(string $class) : \XenForo_Model
The class must exist or be autoloadable or an exception will be thrown.
inherited_from | \XenForo_Model::create() |
---|
string
Class to load
deleteChildNodes(mixed $parentNode, boolean $rebuildCaches) : null
mixed
Parent node: Either node array or node id
boolean
Rebuild caches afterwards
null
fetchAllKeyed(string $sql, string $key, mixed $bind, string $nullPrefix) : array
The 'key' parameter provides the column name with which to key the result. For example, calling fetchAllKeyed('SELECT item_id, title, date FROM table', 'item_id') would result in an array keyed by item_id: [$itemId] => array('item_id' => $itemId, 'title' => $title, 'date' => $date)
Note that the specified key must exist in the query result, or it will be ignored.
inherited_from | \XenForo_Model::fetchAllKeyed() |
---|
string
SQL to execute
string
Column with which to key the results array
mixed
Parameters for the SQL
string
If the key is null, prefix the counter with this
array
filterGroupedNodesToDepth(integer $parentNodeId, array $groupedNodes, integer $depth) : array
integer
Root of the sub-tree or the whole tree (0)
array
Nodes, grouped by parent: [parent node id][node id] => info
integer
Depth to filter to; should be at least 1
array
Filtered, grouped nodesfilterNodeTypesInTree(array $nodes, array $nodeTypes) : array
Children of an excluded node type will be removed, even if they are an included type.
array
Flattened, ordered node tree in order (by lft). Must include depth and node_type_id. Keyed by ID.
\$nodeTypes
[Category, Forum, ... ] or [Category => 1, Forum => 1,...]
array
filterOrphanNodes(array $nodes) : array
Note the caveats: * The list must be in lft order * The nodes must be keyed by their ID
array
array
getAllNodeTypes() : array
array
Format: [node type id] => type infogetAllNodeTypesFromDb() : array
array
Format: [node type id] => type infogetAllNodes(boolean $ignoreNestedSetOrdering, boolean $listView) : array
boolean
If true, ignore nested set infor for ordering and use display_order instead
boolean
If true, only includes nodes viewable in list
array
getChildNodes(array $node, boolean $listView) : mixed
array
boolean
If true, only nodes that are visible in the list view are included
mixed
getChildNodesForNodeIds(array $nodeIds) : array
The child nodes are not grouped.
array
array
Child nodes, [node id] => nodegetChildNodesToDepth(array $node, integer $depth, boolean $listView) : mixed
array
integer
boolean
If true, only nodes that are visible in the list view are included
mixed
getConditionsForClause(array $sqlConditions) : string
This always returns a value that can be used in a clause such as WHERE.
inherited_from | \XenForo_Model::getConditionsForClause() |
---|
array
string
getContentTypeField(string $contentType, string $fieldName) : string | false
inherited_from | \XenForo_Model::getContentTypeField() |
---|
string
string
string
false
getContentTypesWithField(string $fieldName) : array
inherited_from | \XenForo_Model::getContentTypesWithField() |
---|
string
array
Format: [content type] => field valuegetModelFromCache(string $class) : \XenForo_Model
If it does not exist, it will be instantiated.
inherited_from | \XenForo_Model::getModelFromCache() |
---|
string
Name of the class to load
getNewNestedSetInfo(array | null $nodeHierarchy, integer $parentNodeId, integer $depth, integer $lft, integer $effectiveStyleId) : array
Also rebuilds the effective style ID.
array
null
integer
integer
integer
The entry left value; note that this will be changed and returned as the rgt value
integer
The effective style ID from the parent
array
[node_id] => array(lft => int, rgt => int)...getNodeAncestors(array $node) : array
array
array
List of ancestor nodes, from root down; format: [node id] => infogetNodeBreadCrumbs(array $node, boolean $includeSelf) : array
array
boolean
If true, includes itself as the last entry
array
List of nodes that form bread crumbs, root down; [node id] => node infogetNodeById(integer $nodeId, array $fetchOptions) : array
integer
node_id
array
NodegetNodeByName(string $nodeName, string $nodeTypeId, array $fetchOptions) : array | false
string
string
array
array
false
getNodeDataForListDisplay(array | false $parentNode, integer $displayDepth, array $nodePermissions) : array
Returns 3 pieces of data: * nodesGrouped - nodes, grouped by parent, with all data integrated * nodeHandlers - list of node handlers by node type * nodePermissions - the node permissions passed on
array
false
Root node of the tree to display from; false for the entire tree
integer
Number of levels of nodes to display below the root, 0 for all
array
null
List of node permissions, [node id] => permissions; if null, get's current visitor's permissions
array
Empty, or with keys: nodesGrouped, parentNodeId, nodeHandlers, nodePermissionsgetNodeHandlersForNodeTypes(array $nodeTypeIds) : array
array
List of node type IDs
array
Format: [node type id] => node handler objectgetNodeHierarchy(array | null $nodes) : array
array
null
Node list from getAllNodes()
array
Node hierarchygetNodeIdsFromNames(array $nodeNames) : array
array
Node names
array
[node_name] => node_idgetNodeOptionsArray(array $nodes, integer $selectedNodeId, mixed $includeRoot) : array
array
Array of nodes, including node_id, title, parent_node_id and depth keys
integer
NodeId of selected node
mixed
Add root as the first option, and increment all depths by 1 to show indenting. If 'true', the root node will be entitled '(root node)', alternatively, specify a string to use as the option text.
array
getNodePermissionsForPermissionCombination(integer | null $permissionCombinationId) : array
integer
null
If null, uses current visitor permissions
array
getNodeTotalItemCounts(array $parentNode) : array
This does not respect permissions.
array
false
array
Keys: discussions, messagesgetNodeTypeById(string $nodeTypeId) : array
string
node_type_id
array
getNodeTypeByNodeId(integer $nodeId) : \arrayf
integer
\arrayf
getNodeTypeNameById(string $nodeTypeId) : string
string
string
getNodeTypeOptionsArray(array $nodes) : array
array
Array of nodes including node_type_id key
array
getNodeTypesGroupedByPermissionGroup() : array
array
Format: [permission group id][node type id] => node type infogetNodesForAdminQuickSearch(string $searchText) : array
string
Keywords for which to search
array
getNodesToDepthFromRoot(integer $depth) : array
integer
array
Format: [node id] => node infogetOrderByClause(array $choices, array $fetchOptions, string $defaultOrderSql) : string
inherited_from | \XenForo_Model::getOrderByClause() |
---|
array
array
string
string
Order by clause or empty stringgetPossibleParentNodes(array $node) : array
array
Node
array
NodesgetRootNode() : array
array
getSiblingNodes(array $node, boolean $includeSelf, boolean $listView) : array
array
boolean
boolean
If true, only includes nodes viewable in list
array
getUniqueNodeTypeIdsFromNodeList(array $nodes) : array
array
array
List of node type IDsgetViewableNodeList(array $nodePermissions, boolean $listView) : array
array
null
List of node permissions, [node id] => permissions; if null, get's current visitor's permissions
boolean
Get nodes in list mode (respect display_in_list option for each node)
array
List of viewable nodes: [node id] => info, ordered by lftgetViewableNodesFromNodeList(array $nodes, array $nodeHandlers, array $nodePermissions) : array
array
Format: [node id] => info
array
List of node handlers
array
Node permissions, [node id] => permissions
array
List of nodes, [node id] => infogroupNodesByParent(array $nodes) : array
This allows for easier recursive traversal.
array
Format: [node id] => info
array
Format: [parent node id][node id] => infohasChildNodes(array $node) : boolean
array
Node must include lft and rgt keys
boolean
limitQueryResults(string $query, integer $limit, integer $offset) : string
If the limit value is 0 or less, no clause is applied.
inherited_from | \XenForo_Model::limitQueryResults() |
---|
string
SQL query to run
integer
Number of records to limit to; ignored if <= 0
integer
Offset from the start of the records. 0+
string
Query with limit applied if necessarymergeExtraNodeDataIntoNodeList(array $nodes, array $nodeHandlers) : array
array
List of nodes, [node id] => info
array
List of node handlers
array
Node list with extra data merged inmergePushableNodeData(integer $parentNodeId, array $groupedNodes, array $nodeHandlers, array $nodePermissions) : array
integer
Parent node, all children traversed
array
List of grouped nodes. This will be modified by ref!
array
List of node handlers
array
List of node permissions
array
Pushed data for the nodes traversed at this level; [node id] => pushed datamoveChildNodes(mixed $fromNode, mixed $toNode, boolean $rebuildCaches) : null
mixed
Source node: Either node array or node id
mixed
Destination node: Either node array or node id
boolean
Rebuild caches afterwards
null
prepareLimitFetchOptions(array $fetchOptions) : array
Includes: limit, offset, page, and perPage.
inherited_from | \XenForo_Model::prepareLimitFetchOptions() |
---|
array
Unprepared options
array
Limit options; keys: limit, offsetprepareNodeForAdmin(array $node) : array
array
Raw node data
array
Prepared nodeprepareNodesForAdmin(array $nodes) : array
array
Raw nodes
array
Prepared nodesprepareNodesWithHandlers(array $nodes, array $nodeHandlers) : array
array
Unprepared data
array
List of node handlers
array
Prepared dataprepareStateLimitFromConditions(array $fetchOptions, string $table, string $stateField, string $userField) : string
Looks for keys "deleted" and "moderated".
inherited_from | \XenForo_Model::prepareStateLimitFromConditions() |
---|
array
string
Name of the table to prefix the state and user fields with
string
Name of the field that holds the state
string
Name of the field that holds the user ID
string
SQL condition to limit statepushNodeDataUpTree(integer $parentNodeId, array $groupedNodes, array $nodeHandlers, array $nodePermissions) : array
This is used for things like last post data.
integer
ID to start traversing at; all children will be handled
array
Nodes grouped by parent, [parent node id][node id] => info
array
List of node handlers
array
List of node permissions, [node id] => permissions
array
Grouped node list with data pushed up as necessaryrebuildNodeTypeCache() : array
array
Node type cache [node type id] => type inforesetLocalCacheData($name)
This can be used if you know when some cached data has expired.
inherited_from | \XenForo_Model::resetLocalCacheData() |
---|
setAllowCachedRead($allowCachedRead)
This may be controllable on an individual level basis, if the implementation allows it.
inherited_from | \XenForo_Model::setAllowCachedRead() |
---|
boolean
setLocalCacheData(string $name, $value)
This should only be used if you know what you're doing or for testing purposes!
Note that you cannot get the existing data via the public interface. If you think you need the set data, use a new object. It defaults to empty. :)
inherited_from | \XenForo_Model::setLocalCacheData() |
---|
string
standardizeNodePermissionsAndUserId(integer $nodeId, array | null $permissions, integer | null $userId)
If an invalid permission set or user ID is provided, the current visitor's will be used.
inherited_from | \XenForo_Model::standardizeNodePermissionsAndUserId() |
---|
integer
Node permissions are for
array
null
Permissions for node or null to use current visitor's permissions
integer
null
User permissions belong to or null to use current visitor
standardizePermissionCombinationIdAndUserId(integer | null $permissionCombinationId, integer | null $userId)
If null, users current visitor's values.
inherited_from | \XenForo_Model::standardizePermissionCombinationIdAndUserId() |
---|
integer
null
Permission combination ID or null to use current visitor
integer
null
User permissions belong to or null to use current visitor
standardizePermissionsAndUserId(array | null $permissions, integer | null $userId)
If an invalid permission set or user ID is provided, the current visitor's will be used.
inherited_from | \XenForo_Model::standardizePermissionsAndUserId() |
---|
array
null
Global pPermissions or null to use current visitor's permissions
integer
null
User permissions belong to or null to use current visitor
standardizeViewingUserReference(array $viewingUser)
This array must contain all basic user info (preferably all user info) and include global permissions in a "permissions" key. If not an array or missing a user_id, the visitor's values will be used.
inherited_from | \XenForo_Model::standardizeViewingUserReference() |
---|
array
null
standardizeViewingUserReferenceForNode(integer $nodeId, array $viewingUser, array $nodePermissions)
inherited_from | \XenForo_Model::standardizeViewingUserReferenceForNode() |
---|
integer
array
null
Viewing user; if null, use visitor
array
null
Permissions for this node; if null, use visitor's
unserializePermissionsInList(array $items, string $serializedKey, string $targetKey) : array
inherited_from | \XenForo_Model::unserializePermissionsInList() |
---|
array
List of items
string
Key where serialized permissions are
string
Key where unserialized permissions will go
array
List of items with permissions unserializedupdateNestedSetInfo() : array
array
All nodes_getCache(boolean $forceCachedRead) : \Zend_Cache_Core | \Zend_Cache_Frontend | false
If cache reads are disabled, this will return false.
inherited_from | \XenForo_Model::_getCache() |
---|
boolean
If true, the global "allow cached read" value is ignored
\Zend_Cache_Core
\Zend_Cache_Frontend
false
_getDb() : \Zend_Db_Adapter_Abstract
inherited_from | \XenForo_Model::_getDb() |
---|
\Zend_Db_Adapter_Abstract
_getLocalCacheData(string $name) : mixed
inherited_from | \XenForo_Model::_getLocalCacheData() |
---|
string
mixed
_isNode(array $node) : boolean
array
boolean
_isNodeHierarchy(mixed $nodeHierarchy) : boolean
mixed
boolean
_isNodesArray(mixed $nodes) : boolean
mixed
boolean
$_allowCachedRead : boolean
If not, it should be retrieved from the source.
inherited_from | \XenForo_Model::$$_allowCachedRead |
---|
$_cache : \Zend_Cache_Core | \Zend_Cache_Frontend
inherited_from | \XenForo_Model::$$_cache |
---|
$_db : \Zend_Db_Adapter_Abstract
inherited_from | \XenForo_Model::$$_db |
---|
$_localCacheData : array
This data is generally treated as canonical, even if {$_allowCachedRead} is false.
inherited_from | \XenForo_Model::$$_localCacheData |
---|
$_modelCache : array
inherited_from | \XenForo_Model::$$_modelCache |
---|