class DocumentIndex extends Model implements AuditableInterface, SoftDeleteInterface, SerializableInterface

Traits

Trait Auditable to be used in Models

Static Cache Trait Adds a static (per request) cache to the object which can hold data for the time of the request (in the frontend) or a certain duration during long running processes. It works together with the global caching system and enforces a static cache clearing in case of global cache clearings as well.

Trait SoftDeleteTrait to be used in Models, requires deleted_at column in database table

Constants

EVENT_MODEL_AFTER_SAVE

EVENT_MODEL_BEFORE_SAVE

EVENT_MODEL_BEFORE_DELETE

EVENT_MODEL_AFTER_DELETE

FIELD_IS_NULL

$this->find_by_field(Model::IS_NULL)

Properties

System $mod
protected string|null $model_name from  Model
string $table_name
protected bool $table_use_group_id
protected bool $table_auto_properties
protected string $table_primary_key from  Model
protected array $table_primary_compound_key from  Model
protected $properties
protected array $properties_meta from  Model
protected array $markers from  Model
bool|string $class_name from  Model
string $render_type from  Model
protected int $model_version

Hint your model version, this parameter might affect certain outcomes and behaviours This version string is added for backwards compatibility

from  Model
protected string $model_default_render_xui

Defines a XUI helper which can be used to display this model in the render() function e.g. use 'thread' to use this xui helper "XELOS\Modules\Forum\UI\Thread" of the models parent module

from  Model
protected array $render_params

Parameters that will be consigned to the XUI helper

from  Model
static string $find_by_separators from  Model
bool $loaded from  Model
bool $saved from  Model
protected array $changed from  Model
array $cache_function_result from  Model
static array $_request_cache from  Model
static protected bool $auditingDisabled

Is auditing disabled?

from  AuditableTrait
protected $auditExcludedProperties from  AuditableTrait
static int $max_cached_document_indexes
protected bool $hasPrefetchRightsContexts
static protected array|null $document_registry_info_lookup
int $id
string $uuid
int $parent_document
int $parent_group_document
int $instance_id
string $instance_string
int $post_id
int $post_type
int $group_id
int $user_id
string $title
string $thumb_doc
string $canonical
int $canonical_parent
int $canonical_grandparent
int $canonical_greatgrandparent
int $is_hidden
string $post_created_at

Y-m-d H:i:s

string $post_updated_at

Y-m-d H:i:s

string $scheduled_removal_at

Y-m-d H:i:s

DocumentIndexCollection $references
$related_document
DocumentIndexReference[] $possible_rights_context

Methods

__call(string $method, array $args = array())

No description

from  Model
__clone()

Magic Function Object Cloning Make sure object references are cleaned up as each object requires a clean and separate reference

from  Model
__construct(int|bool $id = false)

No description

mixed
__get(mixed $var)

No description

from  Model
__isset($name)

No description

from  Model
__set(mixed $var, mixed $value)

No description

from  Model
__sleep()

No description

string
__toString()

String Representation of this object (calls for render method)

from  Model
__wakeup()

No description

mixed
_call_cached_function(string $function, array $args)

Calls the passed function only if it is not cached yet, otherwise the previous cached result will be returned

from  Model
_scopeAll(Query $Query)

Global named scope scopeAll to use on models to return an unscoped unloaded collection

_scopeDefault(Query $Query)

Load default scopes

_scopeGroupId(Query $Query)

Applies Group ID Filtering

from  Model
_scopeNotDeleted(Query $query)

No description

_scopeSoftDeleted(Query $query)

Function is triggered on scopeSoftDeleted()

_scope_by(string $fn, array $parameters)

Called for scopeby Magic Function Creates a new ModelCollection and applies the passed scope

_scope_custom(string $scopeName, Query|null $Query = null)

Called for scope_ Magic Function Creates a new ModelCollection and applies the passed custom scope function

AuditTrail|null
addAuditTrail(string $event = AuditableInterface::AUDIT_EVENT_MISC, string|null $customMessage = null)

No description

addReferences(DocumentIndexCollection $documentIndexCollection, int $type = 0, string|null $level = null)

Add References to other DocumentIndexes (attachments or content_references e.g. trendvote) Leaving existing references untouched Returns all currently existing references for the given type

add_follow_user(int|null $user_id = null, string $status = Follows::STATUS_FOLLOW, bool $with_notification = false)

Add user as follower. Only add 'auto_follow', if user has no other status

add_formatted_property(string $property, string $format, array $options = array())

Apply lib->format multi_format on passed property. The result will be written to ->[property]_formatted

from  Model
DocumentIndexReference|null
add_reference(DocumentIndex $attachmentDocumentIndex, int $type = 0, string|null $level = null)

Add Document Reference

add_scope_condition(Condition|ConditionGroup|Query|string $new_condition)

Adds a condition to scope the following find functions

Model[]
all(mixed $params = ['order_by'=>'COL1)

Return all models

from  Model
bool
canForceDelete()

Makes sure the soft delete minimum keep duration is observed.

can_read()

Wrapper of original function

bool
can_read_comments()

No description

bool
can_read_comments_global(bool $return_hidden = false)

Checks whether the related document model is allowing comments.

bool
can_read_global($return_hidden = false)

Wrapper of original function

bool
can_see()

Wrapper of original function

bool
can_write()

Wrapper of original function

bool
can_write_global($return_hidden = false)

Wrapper of original function

bool
change_title(string $title)

Changes the title of the document index, publishing the change to the related document.

clear_cache()

Clear local static cache of document indexes

clear_cached_functions(string|bool $function = false)

Clears the cache for all functions or a specific one

from  Model
clear_properties()

No description

from  Model
int
count_all() $eturns the count of all models, see $this->find('count')

No description

from  Model
int
count_by_TABLE_COL_and_TABLE_COL2(mixed $COL1_VALUE, mixed $COL2_VALUE)

Returns the count of all models with the specific column value

from  Model
create_job(string $status = IndexEventInterface::EVENT_UPDATE, DateTimeInterface|null $scheduledAt = null)

creates a new job and stores directly to db

string|void
debug(bool $show_markers = false, int $mode = 0)

No description

from  Model
bool
delete()

Delete this document index and all jobs associated Usually the index will be deleted as result from

void
deleteReferences(int|null $event_user_id = null)

Delete references before deleting model, notify modules that this 'attachment' is gone now

int
delete_by_TABLE_COL(mixed $COL_VALUE) Delete rows specified by condition and returns the affected rows. NOTE: This does not trigger a delete() function of the model. If required use pluck('delete')

on the desired collection.

from  Model
void
disable_table_group_id()

Disable the use of the group ID in all queries made

from  Model
void
enable_table_group_id()

Enable the use of the group ID in all queries made

from  Model
static DocumentIndex|null
fetchDocumentIndex(int $instanceId, int $postType, int $postId)

Returns the document index object for given model information.

static DocumentIndex|null
fetchDocumentIndexById(int $documentIndexId)

Returns the document index object This uses an internal cache if already fetched.

static DocumentIndex|null
fetchDocumentIndexByUuid(string $uuid)

Returns the document index object for given model information.

fetchDocumentIndexCollectionByUuid(array $inputUuids)

Returns the document index object for given model information.

fetchDocumentIndexCollectionByUuidOrId(array $uuids_or_ids)

Returns the document index object for given model information.

fetchDocumentIndexes(int $instanceId, int $postType, array $postIds)

No description

static DocumentModel|null
fetchRelatedDocumentByUuid(string $documentModelClass, string $uuid, bool $ignoreCanReadRights = false)

Return documentModel for given ModuleControllerClass

filterReadable()

Return document only if considered readable/accessible by the current user

find(string $mode = 'all', Condition|ConditionGroup|Query|string|array $conditions = false, array|null $query_params = null)

Find Function to find models using the passed condition

from  Model
static DocumentIndex|null
findWithDeletedById(int $id)

Returns a document even if deleted This method avoids caching mechanisms of document index, as cache will not have deleted items

ModelCollection|Model[]
find_all_by_TABLE_COL_and_TABLE_COL2($COL1_VALUE, $COL2_VALUE, $params=['order_by'=>'COL1, 5]] $)

Returns loaded ModelCollection

from  Model
find_all_by_id(int[] $document_index_ids)

Returns a collection document index models or false if not found

find_all_by_parent_document(int $documentIndexId)

No description

find_all_by_parent_group_document(int $documentIndexId)

No description

find_all_by_post_id_and_post_type_and_instance_id(array $missingPostIds, int $postType, int $instanceId)

No description

find_by_TABLE_COL(mixed $COL_VALUE, mixed $params = ['order_by'=>'COL1)

Returns all models with a specific column value. Query params can be e.g. order_by

from  Model
DocumentIndex|null
find_by_id(int|string $document_index_id)

Returns a collection document index model or false if not found

DocumentIndex|null
find_by_uuid(string $uuid)

No description

bool
forceDelete($force = false)

Will execute standard model delete method.

functionNameToQuery(string $query, array $parameters)

Converts a findby* function name to SQL query.

from  Model
array
getAuditEvents()

Get audit events

array
getAuditExcludeProperties()

Get the (Auditable) properties excluded from audit.

array
getAuditIncludeProperties()

Get the auditable properties to include in audit Defaults to all attributes in the DB Schema

getAuditTrail(int $limit = 50)

Get the last auditTrail records for current Model

string|null
getCanonicalParent(bool $autogenerate = false)

Gets the canonical paht of the parent element. Returns null if there is no parent.

array
getChangedProperties(bool $returnOldValues = false)

Return properties which have been changed after model was initialized/loaded We know these values have been changed locally, but these changes are NOT necessarily reflecting the DB diff

from  Model
getCollectionByQuery(string $model_name, array|string $dbquery_result, string $population_mode = 'full', string $post_fill_function = 'update')

No description

from  Model
array
getDBSchema(string $field = null)

Get DB Schema if available

from  Model
getDocumentIndexReferences(int $type = -1)

Get all document_references this document has

getDocumentPolicyClusters(bool $allowRecalc = false, bool $forceRecalc = false)

Returns all document policy clusters for this document

ModelCollection|null
getFollows(int $user_id = null)

Is user a follower ?

string[]
getI18nPropertyVariants($propertyName, $localeAsKey = false)

Returns a list of all property name variants for all languages, e.g. "title_i18n" -> "title_i18n, title_DE_DE, title_EN_EN"

from  Model
getI18nTokenForProperty(string $i18nProperty, int|null $limitString = null)

Gets an I18nToken for a model property (e.g. title_i18n)

from  Model
MagicDocumentHelper|null
getMagicDocumentHelper()

Assumes a related document which implements FullyIntegratedInterface

array
getParentCanonicals()

Returns an array with the canonicals of all parents e.g. /3/2/1/ -> ['/3/2/1', '/3/2/', '/3/']

int|null
getPrimaryKeyValue()

Get the primary id (post_id) for this model

from  Model
array
getPropertyMarkers(bool $value_discovery = true)

Return properties and markers

from  Model
getScopeQuery(bool $applyDefaultScopes = true)

Returns the Query object which is being used for building the query The function creates a new Query object if required to enable lazy loading

int
getSoftDeleteKeepDays()

Returns how many days the soft deleted documents are kept.

array
getTouchedProperties(bool $returnOldValues = false)

Return properties which have been touched/set after model was initialized/loaded We know these values have been set, but they might not have changed

from  Model
array
get_all_related_documents(DocumentIndexCollection $document_indices)

Function will set related_model for given document index models to improve loading

get_breadcrumb()

Return Breadcrumb showing the primary location of this element

array|null
get_breadcrumb_links()

No description

get_canonical()

No description

get_canonical_document_index_ids()

Return document index ids representing the canonical of this document The last id will be this document return int[] Array of document_index_ids

get_canonical_url()

No description

string
get_created_at_formatted()

Return a Formatted DateTime

from  Model
array
get_db_properties()

Returns all properties which are available as DB field (= can be used as find_by() properties) with its currently known raw value Please note that smartTimeFields (updated_at, created_at) are not converted to mysql-date format

from  Model
DocumentModel|null
get_deleted_related_document()

No description

get_displayname()

Returns the displayname of the user of this document

DocumentRegistry|null
get_document_registry_info()

Return the information from the document registry This information contains additional meta data as well as relational information

get_group_security_id()

Get global group_security_id for this document Uses lib->group_security

bool|mixed
get_i18n_property(string $property, string $force_language = false)

Return the property translated property value if available

from  Model
array
get_instance_meta()

Return Meta information for the instance

Core|null
get_instance_obj()

No description

get_instance_string()

No description

get_instance_url()

No description

string|null
get_model_name()

Returns the SQL table of this model (if available)

from  Model
string|bool
get_model_table_name(string $table_name = null)

Returns the SQL table of this model (if available)

from  Model
DocumentIndex|null
get_parent()

Get a parent element

DocumentIndex|null
get_parent_document_index()

Get a parent element

DocumentIndex|null
get_parent_group()

Get a parent element

array
get_paths()

Return all potential canonical paths element The upper container where this element resides in could be refered

string
get_perma_url(bool $with_domain = false, string|null $alternative_uuid = null)

Returns the perma URL (_doc/goto/{uuid}) for this document

array
get_possible_rights_context()

No description

array
get_properties(bool $value_discovery = true)

Returns the complete properties array

from  Model
array
get_properties_meta(?string $field = null)

No description

from  Model
mixed
get_property(string|null $property_id, bool $get_raw_value = false)

No description

from  Model
get_recent_documents($limit = false)

No description

get_referenced_from(int $type = 0, int|array|null $source_instance_id = null, DocumentIndex $source_document_index = null)

Get all document_index which are referenced from the current document_index

get_references(int $type = 0)

Get all document_index references this document has

get_references_from(int $type = 0, array|int|null $source_instance_id = null, DocumentIndex $source_document_index = null)

Get all document_references which are pointing to this current document_index

DocumentModel|null
get_related_document(bool $ignoreCanReadRights = false)

Get the original document model

static mixed|null
get_request_cache(string $key)

Return Cache Entry if it exists

from  Model
get_root()

No description

string|null
get_table_name()

Returns the table name of this model.

from  Model
string|null
get_table_primary_key()

No description

from  Model
string|null
get_thumb_url(int|null $width = null, int|null $height = null, bool $return_empty = true)

Returns an url to the thumb of this document if available

string
get_title()

Get title

string
get_updated_at_formatted()

Return a Formatted DateTime

from  Model
string
get_url()

Returns the goto URL for this specific document

string
get_uuid()

UUID in Hex Presentation, will automatically generate a uuid if not present yet

string
get_uuid_formatted()

Formatted version of uuid

void
handle_reference_delete(DocumentIndexReference $reference, int|null $event_user_id = null)

Function is called in routine as part of the index event 'delete' Be aware that the original referenced document will not exist at time of calling This event/callback gives the opportunity to clean up the existing reference (e.g. you are referencing to this document and it you need to act upond this element being deleted)

string|null
hasAccessibleDependencyInstanceRelation(string $moduleName = 'comments')

Check wether we have a dependency relation for this document, which is active and accessible to the current user

bool
hasChangedProperties()

No description

from  Model
bool
hasExistingDatabaseRecord()

Does this model represent an existing database record? (can be updated)

from  Model
bool
hasTouchedProperties()

Returns true if at least one property is marked as changed

from  Model
has_related_document()

No description

init(bool $auto_load = true)

Initializes the model

initAuditableTrait()

Init Method

void
initSoftDeleteTrait()

No description

static 
injectDocumentIndex(DocumentModel $model)

Injects the document index object into a related model by setter injection.

bool
isAttachment()

Is this document considered to be an attachment?

bool
isAuditingEnabled()

Determine whether auditing is enabled.

bool
isPersonalAttachment()

Is this document considered accessible as personal attachment?

bool
isPersonalReference()

We need some way to make Trendvote available for linking (similar to isPersonalAttachment) after creation

bool
isSoftDeleted()

No description

bool
is_follow_user($user_id = null)

No description

bool
is_hidden()

Returns if this document index is marked "hidden"

array
jsonSerialize()

No description

load()

No description

from  Model
bool
load_from_db(string $table_name = null, array $key_fields = [])

No description

from  Model
mark_document_recent($user_id, string $type = 'edit')

No description

void
onForceDelete()

Force delete of document index should delete related document and references

void
onRestore()

Called when the model is restored.

void
onSerialize()

Optional: Called before serialization (e.g. to remember/convert an unserializable prop)

void
onSoftDelete()

No description

void
onUnserialize()

Load document from DB on unserialize.

populate_model_by_query(string $model_name, array|string $dbquery_result, string $population_mode = 'full', string $post_fill_function = 'update') deprecated

No description

from  Model
prefetch_document_indexes(array $document_index_ids)

Prefetch document indexes in single batch for later usage via cache

queueExistingDocuments(array $instanceIds = [])

Create queue for existing documents for reindex.

void
registerDefaultScope($scopeName)

Registers the passed scope as default scope A default scope is present when the model is being loaded and can be removed using the unscope() function if required The passed scope must be defined in a scope[SCOPE_NAME] function e.g. scopeGroupId

reload_schema()

Reloads the schema of the model

from  Model
removeReferences(DocumentIndexCollection|null $documentIndexCollection = null, int $type = -1)

Remove given references, return the remaining references

remove_follow_user(int $user_id = null, bool $delete = false)

Remove user as follower

bool
remove_from_db(string $table_name, array $key_fields = null)

No description

from  Model
remove_reference(DocumentIndex $attachmentDocumentIndex)

No description

string|null
render()

Generic Renderer

Template|string
renderPreview()

No description

void
resetScopeQuery()

Reset Scope to null

reset_related_document()

No description

bool
restore()

Recover soft deleted item

int|bool
save()

No description

int|bool
save_to_db(string $table_name, array $params = array())

No description

from  Model
bool|array
schema_values(mixed $field_name)

Provides a list of all values allowed for enumerations.

from  Model
scope(string $scopeName, Query|null $scopeQuery = null)

No description

scopeAll()

No description

scopeNotDeleted()

Default active scope.

scopeSoftDeleted()

Scope to return only soft deleted records.

Model[]
scope_by_TABLE_COL_and_TABLE_COL2(mixed $COL1_VALUE, mixed $COL2_VALUE)

Returns unloaded ModelCollection

from  Model
scope_by_id(int|array $id)

No description

void
self() $this find_by_id($id)

No description

from  Model
array|null
serializePropertiesInclude()

No description

void
setModelCollectionReference(ModelCollection $modelCollectionReference)

No description

setPrefetchRightsContexts(array $rightContexts)

No description

set_hidden(bool $include_subtree = false, bool $hidden = true)

Updates the hidden flag for this document index and all children if so desired

set_post_type(int $post_type)

type-safe setter

void
set_properties_from_array(array $input, array|bool $filter = false)

No description

from  Model
set_property(string|array $property_id, mixed $property_value = false, bool $no_change = false)

Set a Property. If $property_id is an array and $property_value is false, set_property is called for each element in the array with the array key and value as params.

from  Model
set_related_document(DocumentModel $documentModel)

No description

set_render_params(mixed $params = array())

Sets parameter that will be passed to the XUI helpers

from  Model
static 
set_request_cache(string $key, mixed $value)

Set Request Cache Entry

from  Model
int|bool|null
softDelete()

Mark this model as deleted by setting deleted_at to current time

void
sortMoveTo(int $id, int $sortTo, array|null $conditions = [])

Sort this element to a specific position

sort_down(int $steps = 1, $params = array())

Decrease Sort Priority (Increases SORT value)

sort_up(int $steps = 1, $params = array())

Increase Sort Priority (Decreases SORT value)

static void
static void
staticCacheClearCachePool($cache_pool = 'default')

Clears the specified cache pool from the static cache

static array|string|int|bool|null
staticCacheGet($key, string $cache_pool = 'default')

Retrieves a value from the static cache

static array
staticCacheGetKeys(string $cache_pool = 'default')

Returns an array of all cache keys which have been set

static array
staticCacheGetPool($cache_pool)

Returns an key/value array with all cached values from the passed pool

static bool
staticCacheIsEnabled()

No description

static bool
staticCacheIsSet($key, string $cache_pool = 'default')

Checks if the passed is key has a value set

static 
staticCacheRemove($key, string $cache_pool = 'default')

Removes the passed key

static void
staticCacheSet(string|int $key, mixed $value, string $cache_pool = 'default')

Store a value in the static cache

stop_temporary_group_id_overwrite()

Stops the temporary overwrite of the table_group_id

from  Model
void
temporarily_disable_table_group_id()

Temporarily disable the use of the group ID in all queries made

from  Model
string
to_json()

Returns the model as JSON array

from  Model
string
to_string()

Returns the model as STRING

from  Model
string
to_xml(array|bool $property_filter = false, bool|DOMDocument $doc = false, DOMElement $parent_element = null)

Returns an XML of all model properties

from  Model
void
touchProperty($propertyName)

No description

from  Model
triggerAuditEvent(Model $model, string $eventKey = AuditableInterface::OBSERVE_EVENT_SAVE)

TBD: Move this method to the audit model? and keep things slim in trait?

unscope(string $scopeName = null, Query|null $scopeQuery = null)

Returns an unscoped Collection

static object
unserializeObject(SerializedObjectHelper $SerializedObjectHelper)

No description

static object
unserializeObjectFromJSON(string $json)

No description

static 
updateIndexCache(array $indexes)

No description

updateReferences(DocumentIndexCollection $documentIndexCollection, int $type = 0, string|null $level = null)

No description

bool
update_details(DocumentModel $documentModel = null)

Update the document index with the details from the referenced document model

int
update_sort(mixed $id = false, string $direction = 'up', int $steps = 1, array $params = array())

Update the sort property for a given table (Move a record up/down)

string|true
validate(array $fieldErrors)

No description

from  Model

Details

in Model at line 1117
ModelCollection|Model|Model[]|int __call(string $method, array $args = array())

No description

Parameters

string $method method-name
array $args params

Return Value

ModelCollection|Model|Model[]|int
  • Returns resource (find...) or affected rows (count..|deleted..)

in Model at line 1684
__clone()

Magic Function Object Cloning Make sure object references are cleaned up as each object requires a clean and separate reference

at line 102
__construct(int|bool $id = false)

No description

Parameters

int|bool $id

Primary ID of the model which should be loaded

in Model at line 1093
mixed __get(mixed $var)

No description

Parameters

mixed $var

Return Value

mixed

in Model at line 1743
__isset($name)

No description

Parameters

$name

in Model at line 1105
Model __set(mixed $var, mixed $value)

No description

Parameters

mixed $var
mixed $value

Return Value

Model

at line 2301
__sleep()

No description

in Model at line 1695
string __toString()

String Representation of this object (calls for render method)

Return Value

string

at line 2310
__wakeup()

No description

in Model at line 1155
mixed _call_cached_function(string $function, array $args)

Calls the passed function only if it is not cached yet, otherwise the previous cached result will be returned

Parameters

string $function method-name
array $args params

Return Value

mixed

in ScopesTrait at line 100
Query _scopeAll(Query $Query)

Global named scope scopeAll to use on models to return an unscoped unloaded collection

Parameters

Query $Query Query

Return Value

Query

in ScopesTrait at line 111
Query _scopeDefault(Query $Query)

Load default scopes

Parameters

Query $Query

Return Value

Query

in Model at line 1631
protected Query _scopeGroupId(Query $Query)

Applies Group ID Filtering

Parameters

Query $Query

Return Value

Query

in SoftDeleteTrait at line 37
Query _scopeNotDeleted(Query $query)

No description

Parameters

Query $query

Return Value

Query

in SoftDeleteTrait at line 51
Query _scopeSoftDeleted(Query $query)

Function is triggered on scopeSoftDeleted()

Parameters

Query $query

Return Value

Query

in ScopesTrait at line 143
protected ModelCollection _scope_by(string $fn, array $parameters)

Called for scopeby Magic Function Creates a new ModelCollection and applies the passed scope

Parameters

string $fn
array $parameters

Return Value

ModelCollection

in ScopesTrait at line 159
protected ModelCollection _scope_custom(string $scopeName, Query|null $Query = null)

Called for scope_ Magic Function Creates a new ModelCollection and applies the passed custom scope function

Parameters

string $scopeName

Name of the custom scope - e.g. Active - calls _scopeActive() on the model

Query|null $Query

Return Value

ModelCollection

in AuditableTrait at line 97
AuditTrail|null addAuditTrail(string $event = AuditableInterface::AUDIT_EVENT_MISC, string|null $customMessage = null)

No description

Parameters

string $event
string|null $customMessage

Return Value

AuditTrail|null

Exceptions

AuditException

See also

AuditableInterface::addAuditTrail

at line 1930
DocumentIndexReferenceCollection addReferences(DocumentIndexCollection $documentIndexCollection, int $type = 0, string|null $level = null)

Add References to other DocumentIndexes (attachments or content_references e.g. trendvote) Leaving existing references untouched Returns all currently existing references for the given type

Parameters

DocumentIndexCollection $documentIndexCollection
int $type
string|null $level

leave as null for automatic owner/read levels

Return Value

DocumentIndexReferenceCollection

at line 1735
add_follow_user(int|null $user_id = null, string $status = Follows::STATUS_FOLLOW, bool $with_notification = false)

Add user as follower. Only add 'auto_follow', if user has no other status

Parameters

int|null $user_id
string $status ('follow','auto_follow','ignore')
bool $with_notification

in Model at line 954
add_formatted_property(string $property, string $format, array $options = array())

Apply lib->format multi_format on passed property. The result will be written to ->[property]_formatted

Parameters

string $property

Property of models to format

string $format

Format Type (e.g. money, date, ...)

array $options

Additional format options

at line 1879
DocumentIndexReference|null add_reference(DocumentIndex $attachmentDocumentIndex, int $type = 0, string|null $level = null)

Add Document Reference

Parameters

DocumentIndex $attachmentDocumentIndex

Usually your attachment, id or uuid

int $type

Type can be used by the referencing module to distinguish references (e.g. used in system tasks)

string|null $level

possible values are 'read', 'owner', 'share' or null, whereas null will automatically try to set the correct level

Return Value

DocumentIndexReference|null DocumentIndexReference

Exceptions

InvalidArgumentException

in ScopesTrait at line 34
ModelCollection add_scope_condition(Condition|ConditionGroup|Query|string $new_condition)

Adds a condition to scope the following find functions

Parameters

Condition|ConditionGroup|Query|string $new_condition

Return Value

ModelCollection

in Model at line 40
Model[] all(mixed $params = ['order_by'=>'COL1)

Return all models

Parameters

mixed $params

Return Value

Model[]

in SoftDeleteTrait at line 150
bool canForceDelete()

Makes sure the soft delete minimum keep duration is observed.

e.g. document was deleted 30 days ago, but the keep duration was increased to 120 days.

Return Value

bool

at line 2130
can_read()

Wrapper of original function

at line 2233
bool can_read_comments()

No description

Return Value

bool

at line 2248
bool can_read_comments_global(bool $return_hidden = false)

Checks whether the related document model is allowing comments.

Parameters

bool $return_hidden

Return Value

bool

See also

DocumentModel::can_read_comments

at line 2170
bool can_read_global($return_hidden = false)

Wrapper of original function

Parameters

$return_hidden

Return Value

bool

at line 2190
bool can_see()

Wrapper of original function

Return Value

bool

at line 2206
bool can_write()

Wrapper of original function

Return Value

bool

Exceptions

Exception

at line 2217
bool can_write_global($return_hidden = false)

Wrapper of original function

Parameters

$return_hidden

Return Value

bool

at line 1354
bool change_title(string $title)

Changes the title of the document index, publishing the change to the related document.

The title cannot be changed if the related document is not available or cannot be written to. The current user MUST have can_write_global in order to change the title of the document

Parameters

string $title

The new title

Return Value

bool

TRUE if the change was successfull, FALSE if not

at line 567
clear_cache()

Clear local static cache of document indexes

in Model at line 1174
clear_cached_functions(string|bool $function = false)

Clears the cache for all functions or a specific one

Parameters

string|bool $function

in Model at line 616
clear_properties()

No description

in Model at line 40
int count_all() $eturns the count of all models, see $this->find('count')

No description

Parameters

) $eturns the count of all models
see $this->find('count'

Return Value

int

in Model at line 40
int count_by_TABLE_COL_and_TABLE_COL2(mixed $COL1_VALUE, mixed $COL2_VALUE)

Returns the count of all models with the specific column value

Parameters

mixed $COL1_VALUE
mixed $COL2_VALUE

Return Value

int

at line 1276
create_job(string $status = IndexEventInterface::EVENT_UPDATE, DateTimeInterface|null $scheduledAt = null)

creates a new job and stores directly to db

Parameters

string $status
DateTimeInterface|null $scheduledAt

in Model at line 939
string|void debug(bool $show_markers = false, int $mode = 0)

No description

Parameters

bool $show_markers

show markers as well?

int $mode

(0 - print, 1 - return, 2 and 3 - Special PopUps)

Return Value

string|void

at line 862
bool delete()

Delete this document index and all jobs associated Usually the index will be deleted as result from

Return Value

bool

was delete successful?

See also

DocumentModel::remove_document_index

at line 2387
void deleteReferences(int|null $event_user_id = null)

Delete references before deleting model, notify modules that this 'attachment' is gone now

Parameters

int|null $event_user_id

Return Value

void

in Model at line 40
int delete_by_TABLE_COL(mixed $COL_VALUE) Delete rows specified by condition and returns the affected rows. NOTE: This does not trigger a delete() function of the model. If required use pluck('delete')

on the desired collection.

Parameters

mixed $COL_VALUE) Delete rows specified by condition and returns the affected rows. NOTE: This does not trigger a delete() function of the model. If required use pluck('delete'

Return Value

int

in Model at line 1642
void disable_table_group_id()

Disable the use of the group ID in all queries made

Return Value

void

in Model at line 1667
void enable_table_group_id()

Enable the use of the group ID in all queries made

Return Value

void

at line 258
static DocumentIndex|null fetchDocumentIndex(int $instanceId, int $postType, int $postId)

Returns the document index object for given model information.

This uses an internal cache if already fetched.

Parameters

int $instanceId
int $postType
int $postId

Return Value

DocumentIndex|null

at line 243
static DocumentIndex|null fetchDocumentIndexById(int $documentIndexId)

Returns the document index object This uses an internal cache if already fetched.

Parameters

int $documentIndexId

Return Value

DocumentIndex|null

at line 293
static DocumentIndex|null fetchDocumentIndexByUuid(string $uuid)

Returns the document index object for given model information.

This uses an internal cache if already fetched.

Parameters

string $uuid

Hex Value

Return Value

DocumentIndex|null

at line 323
static DocumentIndexCollection fetchDocumentIndexCollectionByUuid(array $inputUuids)

Returns the document index object for given model information.

This uses an internal cache if already fetched.

Parameters

array $inputUuids

Array with Hex Values

Return Value

DocumentIndexCollection

at line 353
static DocumentIndexCollection fetchDocumentIndexCollectionByUuidOrId(array $uuids_or_ids)

Returns the document index object for given model information.

This uses an internal cache if already fetched.

Parameters

array $uuids_or_ids

Array with Hex Values

Return Value

DocumentIndexCollection

at line 377
static DocumentIndexCollection fetchDocumentIndexes(int $instanceId, int $postType, array $postIds)

No description

Parameters

int $instanceId
int $postType
array $postIds

Return Value

DocumentIndexCollection

at line 413
static DocumentModel|null fetchRelatedDocumentByUuid(string $documentModelClass, string $uuid, bool $ignoreCanReadRights = false)

Return documentModel for given ModuleControllerClass

Parameters

string $documentModelClass
string $uuid
bool $ignoreCanReadRights

Return Value

DocumentModel|null

at line 2480
DocumentIndex|null filterReadable()

Return document only if considered readable/accessible by the current user

Return Value

DocumentIndex|null

in Model at line 1218
ModelCollection|Model|int|null find(string $mode = 'all', Condition|ConditionGroup|Query|string|array $conditions = false, array|null $query_params = null)

Find Function to find models using the passed condition

Parameters

string $mode

Find mode (all/first/count)

Condition|ConditionGroup|Query|string|array $conditions

Conditions passed as field query string (e.g. 'id=1 and name="TEST"') or as legacy array: First Element contains query, 2..n contain Parameters

array|null $query_params

Further query parameters (e.g. limit, order_by, request_cache)

Return Value

ModelCollection|Model|int|null

depending from $mode: ALL: ModelCollection; FIRST: Model | boolean false on fail COUNT: int

at line 2348
static DocumentIndex|null findWithDeletedById(int $id)

Returns a document even if deleted This method avoids caching mechanisms of document index, as cache will not have deleted items

Parameters

int $id

Return Value

DocumentIndex|null

in Model at line 40
ModelCollection|Model[] find_all_by_TABLE_COL_and_TABLE_COL2($COL1_VALUE, $COL2_VALUE, $params=['order_by'=>'COL1, 5]] $)

Returns loaded ModelCollection

Parameters

$COL1_VALUE
$COL2_VALUE
$params=['order_by'=>'COL1
5]] $

Return Value

ModelCollection|Model[]

at line 537
DocumentIndexCollection find_all_by_id(int[] $document_index_ids)

Returns a collection document index models or false if not found

Parameters

int[] $document_index_ids

Return Value

DocumentIndexCollection

at line 64
DocumentIndexCollection find_all_by_parent_document(int $documentIndexId)

No description

Parameters

int $documentIndexId

Return Value

DocumentIndexCollection

at line 64
DocumentIndexCollection find_all_by_parent_group_document(int $documentIndexId)

No description

Parameters

int $documentIndexId

Return Value

DocumentIndexCollection

at line 64
DocumentIndexCollection find_all_by_post_id_and_post_type_and_instance_id(array $missingPostIds, int $postType, int $instanceId)

No description

Parameters

array $missingPostIds
int $postType
int $instanceId

Return Value

DocumentIndexCollection

in Model at line 40
Model find_by_TABLE_COL(mixed $COL_VALUE, mixed $params = ['order_by'=>'COL1)

Returns all models with a specific column value. Query params can be e.g. order_by

Parameters

mixed $COL_VALUE
mixed $params

Return Value

Model

at line 556
DocumentIndex|null find_by_id(int|string $document_index_id)

Returns a collection document index model or false if not found

Parameters

int|string $document_index_id

Accepts ID and UUID

Return Value

DocumentIndex|null

at line 64
DocumentIndex|null find_by_uuid(string $uuid)

No description

Parameters

string $uuid

Return Value

DocumentIndex|null

in SoftDeleteTrait at line 86
bool forceDelete($force = false)

Will execute standard model delete method.

Parameters

$force

Return Value

bool

in Model at line 1402
protected Query functionNameToQuery(string $query, array $parameters)

Converts a findby* function name to SQL query.

Parameters

string $query
array $parameters

Return Value

Query

Returns a Query Object with the relevant WHERE Scopes

in AuditableTrait at line 166
array getAuditEvents()

Get audit events

Return Value

array

in AuditableTrait at line 220
array getAuditExcludeProperties()

Get the (Auditable) properties excluded from audit.

Defaults to primary_key and timestamps

Return Value

array

in AuditableTrait at line 199
array getAuditIncludeProperties()

Get the auditable properties to include in audit Defaults to all attributes in the DB Schema

Return Value

array

in AuditableTrait at line 183
AuditTrail[]|ModelCollection getAuditTrail(int $limit = 50)

Get the last auditTrail records for current Model

Parameters

int $limit

Return Value

AuditTrail[]|ModelCollection

at line 584
string|null getCanonicalParent(bool $autogenerate = false)

Gets the canonical paht of the parent element. Returns null if there is no parent.

Parameters

bool $autogenerate

Return Value

string|null $parentCanonical

in Model at line 1857
array getChangedProperties(bool $returnOldValues = false)

Return properties which have been changed after model was initialized/loaded We know these values have been changed locally, but these changes are NOT necessarily reflecting the DB diff

Parameters

bool $returnOldValues

Return values before change or current value after change?

Return Value

array ['property_key'=>'property_value']

in Model at line 970
ModelCollection getCollectionByQuery(string $model_name, array|string $dbquery_result, string $population_mode = 'full', string $post_fill_function = 'update')

No description

Parameters

string $model_name

Model Name, eg.g. category

array|string $dbquery_result

dbquery Result with one record per model OR SQL query

string $population_mode

Population Mode (full or id) - If set to full all object data will be used to fill the objects, if set to id each model will be initialized with the corresponding record id as parameter

string $post_fill_function

Post-Fill Function is triggered on the each model after an object has been filled with data

Return Value

ModelCollection

Always returns a model collection

in Model at line 191
array getDBSchema(string $field = null)

Get DB Schema if available

Parameters

string $field

Return Value

array

at line 2067
DocumentIndexReferenceCollection getDocumentIndexReferences(int $type = -1)

Get all document_references this document has

Parameters

int $type

(-1 for all references regardless of type)

Return Value

DocumentIndexReferenceCollection

at line 429
ModelCollection getDocumentPolicyClusters(bool $allowRecalc = false, bool $forceRecalc = false)

Returns all document policy clusters for this document

Parameters

bool $allowRecalc

By default the existing clusters will be returned. If set to true these will be recalculated in case they are outdated

bool $forceRecalc

Enforce the recalculation - even for still valid clusters

Return Value

ModelCollection

at line 1804
ModelCollection|null getFollows(int $user_id = null)

Is user a follower ?

Parameters

int $user_id

Return Value

ModelCollection|null

follows info ordered from specific to parent or false

in Model at line 1806
string[] getI18nPropertyVariants($propertyName, $localeAsKey = false)

Returns a list of all property name variants for all languages, e.g. "title_i18n" -> "title_i18n, title_DE_DE, title_EN_EN"

Parameters

$propertyName
$localeAsKey

Return Value

string[]

in Model at line 1914
I18nTokenHelper getI18nTokenForProperty(string $i18nProperty, int|null $limitString = null)

Gets an I18nToken for a model property (e.g. title_i18n)

Parameters

string $i18nProperty

The property name (e.g. title_i18n)

int|null $limitString

The translated string will be only $limitString amount of characters long (Adds '...' at the end of the string)

Return Value

I18nTokenHelper

at line 2489
MagicDocumentHelper|null getMagicDocumentHelper()

Assumes a related document which implements FullyIntegratedInterface

Return Value

MagicDocumentHelper|null

at line 64
DocumentIndexCollection getModelCollection()

No description

at line 1233
array getParentCanonicals()

Returns an array with the canonicals of all parents e.g. /3/2/1/ -> ['/3/2/1', '/3/2/', '/3/']

Return Value

array

in Model at line 334
int|null getPrimaryKeyValue()

Get the primary id (post_id) for this model

Return Value

int|null

in Model at line 492
array getPropertyMarkers(bool $value_discovery = true)

Return properties and markers

Parameters

bool $value_discovery

Return Value

array

in ScopesTrait at line 217
Query getScopeQuery(bool $applyDefaultScopes = true)

Returns the Query object which is being used for building the query The function creates a new Query object if required to enable lazy loading

Parameters

bool $applyDefaultScopes

Return Value

Query

in SoftDeleteTrait at line 139
int getSoftDeleteKeepDays()

Returns how many days the soft deleted documents are kept.

Return Value

int

in Model at line 1827
array getTouchedProperties(bool $returnOldValues = false)

Return properties which have been touched/set after model was initialized/loaded We know these values have been set, but they might not have changed

Parameters

bool $returnOldValues

Return values before change or current value after change?

Return Value

array ['property_key'=>'property_value']

Function will set related_model for given document index models to improve loading

Parameters

DocumentIndexCollection $document_indices

Return Value

array

at line 711
Breadcrumb get_breadcrumb()

Return Breadcrumb showing the primary location of this element

Return Value

Breadcrumb

No description

Return Value

array|null

at line 571
get_canonical()

No description

at line 700
get_canonical_document_index_ids()

Return document index ids representing the canonical of this document The last id will be this document return int[] Array of document_index_ids

at line 601
get_canonical_url()

No description

at line 1248
DocumentIndexCollection get_children_document()

Get child elements

in Model at line 1611
string get_created_at_formatted()

Return a Formatted DateTime

Return Value

string

in Model at line 520
array get_db_properties()

Returns all properties which are available as DB field (= can be used as find_by() properties) with its currently known raw value Please note that smartTimeFields (updated_at, created_at) are not converted to mysql-date format

Return Value

array ['id'=>'1','example_prop'=>'example_val','created_at'=>'']

No description

Return Value

DocumentModel|null

at line 844
get_displayname()

Returns the displayname of the user of this document

at line 1114
DocumentRegistry|null get_document_registry_info()

Return the information from the document registry This information contains additional meta data as well as relational information

Return Value

DocumentRegistry|null

at line 674
get_group_security_id()

Get global group_security_id for this document Uses lib->group_security

in Model at line 1784
bool|mixed get_i18n_property(string $property, string $force_language = false)

Return the property translated property value if available

Parameters

string $property

e.g. title_i18n

string $force_language

FALSE will use current user language, otherwise the passed LOCALE will be used

Return Value

bool|mixed

at line 690
array get_instance_meta()

Return Meta information for the instance

Return Value

array

= ['title'=>"TITLE",'type'=>"module",'module_name'=>'MODULE','instance_id'=>'...']

at line 1015
Core|null get_instance_obj()

No description

Return Value

Core|null

at line 678
get_instance_string()

No description

at line 794
get_instance_url()

No description

in Model at line 351
string|null get_model_name()

Returns the SQL table of this model (if available)

Return Value

string|null

Full qualified table name e.g. xmi_crm01_contact

in Model at line 312
string|bool get_model_table_name(string $table_name = null)

Returns the SQL table of this model (if available)

Parameters

string $table_name

Simple table without instance or system prefix

Return Value

string|bool

Full qualified table name e.g. xmi_crm01_contact

at line 1190
DocumentIndex|null get_parent()

Get a parent element

Return Value

DocumentIndex|null

at line 1218
DocumentIndex|null get_parent_document_index()

Get a parent element

Return Value

DocumentIndex|null

at line 1203
DocumentIndex|null get_parent_group()

Get a parent element

Return Value

DocumentIndex|null

at line 980
array get_paths()

Return all potential canonical paths element The upper container where this element resides in could be refered

Return Value

array

e.g. ['/a/','/a/b/','/a/b/c/']

at line 784
string get_perma_url(bool $with_domain = false, string|null $alternative_uuid = null)

Returns the perma URL (_doc/goto/{uuid}) for this document

Parameters

bool $with_domain
string|null $alternative_uuid

Allows passing an alternative uuid which will be used if this document is no longer available

Return Value

string

Exceptions

Exception

at line 996
array get_possible_rights_context()

No description

Return Value

array

in Model at line 474
array get_properties(bool $value_discovery = true)

Returns the complete properties array

Parameters

bool $value_discovery

Retrieve all values by get_property access method

Return Value

array

in Model at line 508
array get_properties_meta(?string $field = null)

No description

Parameters

?string $field

if given returns the meta for that field

Return Value

array

in Model at line 434
mixed get_property(string|null $property_id, bool $get_raw_value = false)

No description

Parameters

string|null $property_id

Marker ID

bool $get_raw_value

deactivate Marker-Function gets triggered

Return Value

mixed

Marker Content

at line 609
Document[] get_recent_documents($limit = false)

No description

Parameters

$limit

Return Value

Document[]

at line 2051
DocumentIndexCollection get_referenced_from(int $type = 0, int|array|null $source_instance_id = null, DocumentIndex $source_document_index = null)

Get all document_index which are referenced from the current document_index

Parameters

int $type

(-1 for all references regardless of type)

int|array|null $source_instance_id

Filter references from given instance id

DocumentIndex $source_document_index

Return Value

DocumentIndexCollection

Exceptions

Exception

at line 2027
DocumentIndexCollection get_references(int $type = 0)

Get all document_index references this document has

Parameters

int $type

set to -1 for all refs regardless of type

Return Value

DocumentIndexCollection

at line 2087
DocumentIndexReferenceCollection get_references_from(int $type = 0, array|int|null $source_instance_id = null, DocumentIndex $source_document_index = null)

Get all document_references which are pointing to this current document_index

Parameters

int $type

(-1 for all references regardless of type)

array|int|null $source_instance_id

Filter references from given instance id

DocumentIndex $source_document_index

Return Value

DocumentIndexReferenceCollection

Get the original document model

Parameters

bool $ignoreCanReadRights

Set to true if you want to ignore can_read check. Document will NOT be cached if set to true

Return Value

DocumentModel|null

in Model at line 1772
static mixed|null get_request_cache(string $key)

Return Cache Entry if it exists

Parameters

string $key

Cache Key

Return Value

mixed|null

at line 1178
DocumentIndex get_root()

No description

Return Value

DocumentIndex

in Model at line 303
string|null get_table_name()

Returns the table name of this model.

Return Value

string|null

in Model at line 325
string|null get_table_primary_key()

No description

Return Value

string|null

Primary Key Field in DB

at line 1261
string|null get_thumb_url(int|null $width = null, int|null $height = null, bool $return_empty = true)

Returns an url to the thumb of this document if available

Parameters

int|null $width
int|null $height
bool $return_empty

Return Value

string|null

at line 829
string get_title()

Get title

Return Value

string

in Model at line 1620
string get_updated_at_formatted()

Return a Formatted DateTime

Return Value

string

at line 773
string get_url()

Returns the goto URL for this specific document

Return Value

string

at line 1542
string get_uuid()

UUID in Hex Presentation, will automatically generate a uuid if not present yet

Return Value

string

Exceptions

Exception

at line 1558
string get_uuid_formatted()

Formatted version of uuid

Return Value

string

Exceptions

Exception

at line 2119
void handle_reference_delete(DocumentIndexReference $reference, int|null $event_user_id = null)

Function is called in routine as part of the index event 'delete' Be aware that the original referenced document will not exist at time of calling This event/callback gives the opportunity to clean up the existing reference (e.g. you are referencing to this document and it you need to act upond this element being deleted)

Parameters

DocumentIndexReference $reference
int|null $event_user_id

The user (if known to the event) who deleted or triggered the delete

Return Value

void

at line 1140
string|null hasAccessibleDependencyInstanceRelation(string $moduleName = 'comments')

Check wether we have a dependency relation for this document, which is active and accessible to the current user

Parameters

string $moduleName

Return Value

string|null

Returns Instance String of the dependency

in Model at line 1868
bool hasChangedProperties()

No description

Return Value

bool

in Model at line 807
bool hasExistingDatabaseRecord()

Does this model represent an existing database record? (can be updated)

Return Value

bool

in Model at line 1835
bool hasTouchedProperties()

Returns true if at least one property is marked as changed

Return Value

bool

No description

at line 107
init(bool $auto_load = true)

Initializes the model

Parameters

bool $auto_load

If set to false the init will NOT TRIGGER load in case of a set primary key property

in AuditableTrait at line 43
initAuditableTrait()

Init Method

in SoftDeleteTrait at line 33
void initSoftDeleteTrait()

No description

Return Value

void

at line 511
static injectDocumentIndex(DocumentModel $model)

Injects the document index object into a related model by setter injection.

Parameters

DocumentModel $model

at line 2432
bool isAttachment()

Is this document considered to be an attachment?

Return Value

bool

in AuditableTrait at line 233
bool isAuditingEnabled()

Determine whether auditing is enabled.

Defaults to true for Frontend/UI Actions and false for CLI/Console Actions

Return Value

bool

at line 2461
bool isPersonalAttachment()

Is this document considered accessible as personal attachment?

This document is most likely currently uploaded and has not been saved as reference yet. It is not visible to most functions and should be deleted if not saved properly against an owner reference

Return Value

bool

at line 2470
bool isPersonalReference()

We need some way to make Trendvote available for linking (similar to isPersonalAttachment) after creation

Return Value

bool

in SoftDeleteTrait at line 122
bool isSoftDeleted()

No description

Return Value

bool

at line 1794
bool is_follow_user($user_id = null)

No description

Parameters

$user_id

Return Value

bool

at line 2141
bool is_hidden()

Returns if this document index is marked "hidden"

Return Value

bool

array jsonSerialize()

No description

Return Value

array

Exceptions

ReflectionException

in Model at line 390
load()

No description

in Model at line 837
protected bool load_from_db(string $table_name = null, array $key_fields = [])

No description

Parameters

string $table_name

Table Name

array $key_fields

Key fields which should be used as WHERE condition

Return Value

bool

at line 641
mark_document_recent($user_id, string $type = 'edit')

No description

Parameters

$user_id
string $type

Exceptions

Exception

at line 2363
void onForceDelete()

Force delete of document index should delete related document and references

Return Value

void

Exceptions

AuditException

at line 2314
void onRestore()

Called when the model is restored.

Return Value

void

void onSerialize()

Optional: Called before serialization (e.g. to remember/convert an unserializable prop)

Return Value

void

at line 2336
void onSoftDelete()

No description

Return Value

void

at line 2420
void onUnserialize()

Load document from DB on unserialize.

Return Value

void

in Model at line 1062
ModelCollection|Model[] populate_model_by_query(string $model_name, array|string $dbquery_result, string $population_mode = 'full', string $post_fill_function = 'update') deprecated

deprecated Please use getCollectionByQuery() instead

No description

Parameters

string $model_name

Model Name, eg.g. category

array|string $dbquery_result

dbquery Result with one record per model OR SQL query

string $population_mode

Population Mode (full or id) - If set to full all object data will be used to fill the objects, if set to id each model will be initialized with the corresponding record id as parameter

string $post_fill_function

Post-Fill Function is triggered on the each model after an object has been filled with data

Return Value

ModelCollection|Model[]

empty array if none found and compatibility-mode on (xelos model_version < 1)

at line 121
static DocumentIndexCollection prefetch_document_indexes(array $document_index_ids)

Prefetch document indexes in single batch for later usage via cache

Parameters

array $document_index_ids

Return Value

DocumentIndexCollection

at line 1322
queueExistingDocuments(array $instanceIds = [])

Create queue for existing documents for reindex.

If no instance ids are given, this will affect all documents.

Parameters

array $instanceIds

Instance ids from which documents should be reindexed

in ScopesTrait at line 127
protected void registerDefaultScope($scopeName)

Registers the passed scope as default scope A default scope is present when the model is being loaded and can be removed using the unscope() function if required The passed scope must be defined in a scope[SCOPE_NAME] function e.g. scopeGroupId

Parameters

$scopeName

Return Value

void

in Model at line 161
reload_schema()

Reloads the schema of the model

at line 1954
DocumentIndexReferenceCollection removeReferences(DocumentIndexCollection|null $documentIndexCollection = null, int $type = -1)

Remove given references, return the remaining references

Parameters

DocumentIndexCollection|null $documentIndexCollection
int $type

Return Value

DocumentIndexReferenceCollection

at line 1765
remove_follow_user(int $user_id = null, bool $delete = false)

Remove user as follower

Parameters

int $user_id
bool $delete

Should the follow status be removed from DB, or only set to "not follow" based on the circumstances?

Exceptions

Exception

in Model at line 904
protected bool remove_from_db(string $table_name, array $key_fields = null)

No description

Parameters

string $table_name

Table Name

array $key_fields

Key fields which should be used as WHERE condition

Return Value

bool

at line 2010
remove_reference(DocumentIndex $attachmentDocumentIndex)

No description

Parameters

DocumentIndex $attachmentDocumentIndex

Usually your attachment, id or uuid

at line 2275
string|null render()

Generic Renderer

Return Value

string|null

at line 2286
Template|string renderPreview()

No description

Return Value

Template|string

in ScopesTrait at line 231
void resetScopeQuery()

Reset Scope to null

Return Value

void

No description

in SoftDeleteTrait at line 106
bool restore()

Recover soft deleted item

Return Value

bool

Was restore successful?

Exceptions

AuditException

at line 2500
int|bool save()

No description

Return Value

int|bool

Integer represents ID of saved record, true for successful modifications (update, delete), false otherwise

Exceptions

Exception

in Model at line 633
protected int|bool save_to_db(string $table_name, array $params = array())

No description

Parameters

string $table_name

Table Name

array $params

Return Value

int|bool

Integer represents ID of saved record, true for successful modifications (update, delete), false otherwise

Exceptions

DatabaseException

in Model at line 1381
bool|array schema_values(mixed $field_name)

Provides a list of all values allowed for enumerations.

Returns FALSE if the field in question does not exist Returns TRUE for non enum fields Returns an array for enum fields with all available values

Parameters

mixed $field_name

The name of the field to examine

Return Value

bool|array

in ScopesTrait at line 81
ModelCollection scope(string $scopeName, Query|null $scopeQuery = null)

No description

Parameters

string $scopeName
Query|null $scopeQuery

Return Value

ModelCollection

in ScopesTrait at line 16
ModelCollection scopeAll()

No description

Return Value

ModelCollection

in SoftDeleteTrait at line 31
ModelCollection scopeNotDeleted()

Default active scope.

Return Value

ModelCollection

in SoftDeleteTrait at line 31
ModelCollection scopeSoftDeleted()

Scope to return only soft deleted records.

Return Value

ModelCollection

in Model at line 40
Model[] scope_by_TABLE_COL_and_TABLE_COL2(mixed $COL1_VALUE, mixed $COL2_VALUE)

Returns unloaded ModelCollection

Parameters

mixed $COL1_VALUE
mixed $COL2_VALUE

Return Value

Model[]

in ScopesTrait at line 16
ModelCollection scope_by_id(int|array $id)

No description

Parameters

int|array $id

Return Value

ModelCollection

in Model at line 40
void self() $this find_by_id($id)

No description

Parameters

) $this find_by_id($id

Return Value

void

SerializedObjectHelper serializeObject()

No description

at line 2413
protected array|null serializePropertiesInclude()

No description

Return Value

array|null

in ScopesTrait at line 88
void setModelCollectionReference(ModelCollection $modelCollectionReference)

No description

Parameters

ModelCollection $modelCollectionReference

Return Value

void

at line 526
setPrefetchRightsContexts(array $rightContexts)

No description

Parameters

array $rightContexts

at line 2151
set_hidden(bool $include_subtree = false, bool $hidden = true)

Updates the hidden flag for this document index and all children if so desired

Parameters

bool $include_subtree

Shall all children be set to the same value?

bool $hidden

Defines the value of the flag (hidden TRUE or FALSE)

at line 837
set_post_type(int $post_type)

type-safe setter

Parameters

int $post_type

in Model at line 599
void set_properties_from_array(array $input, array|bool $filter = false)

No description

Parameters

array $input

Assoc array with field_id=>value

array|bool $filter

Filter array with 1-dim field_id's, only these keys from input will be set

Return Value

void

in Model at line 540
set_property(string|array $property_id, mixed $property_value = false, bool $no_change = false)

Set a Property. If $property_id is an array and $property_value is false, set_property is called for each element in the array with the array key and value as params.

Parameters

string|array $property_id

Marker ID (Can also be an Array)

mixed $property_value Value
bool $no_change

Value

return static

No description

Parameters

DocumentModel $documentModel

in Model at line 1716
set_render_params(mixed $params = array())

Sets parameter that will be passed to the XUI helpers

Parameters

mixed $params

in Model at line 1756
static set_request_cache(string $key, mixed $value)

Set Request Cache Entry

Parameters

string $key
mixed $value

in SoftDeleteTrait at line 67
int|bool|null softDelete()

Mark this model as deleted by setting deleted_at to current time

Return Value

int|bool|null

in SortTrait at line 116
void sortMoveTo(int $id, int $sortTo, array|null $conditions = [])

Sort this element to a specific position

Parameters

int $id

The record ID you intend to move, use 0 if your model has not been saved yet and you intend to save it to the given sort

int $sortTo

Move element to this new position, should be > 0

array|null $conditions

Add conditions

Return Value

void

in SortTrait at line 28
sort_down(int $steps = 1, $params = array())

Decrease Sort Priority (Increases SORT value)

Parameters

int $steps
$params

in SortTrait at line 17
sort_up(int $steps = 1, $params = array())

Increase Sort Priority (Decreases SORT value)

Parameters

int $steps
$params

in StaticCacheTrait at line 121
static void staticCacheClearAllCachePools()

No description

Return Value

void

in StaticCacheTrait at line 114
static void staticCacheClearCachePool($cache_pool = 'default')

Clears the specified cache pool from the static cache

Parameters

$cache_pool

Return Value

void

in StaticCacheTrait at line 61
static array|string|int|bool|null staticCacheGet($key, string $cache_pool = 'default')

Retrieves a value from the static cache

Parameters

$key
string $cache_pool

Return Value

array|string|int|bool|null

Returns the cached result or null if no value has been stored

in StaticCacheTrait at line 98
static array staticCacheGetKeys(string $cache_pool = 'default')

Returns an array of all cache keys which have been set

Parameters

string $cache_pool

Return Value

array

in StaticCacheTrait at line 107
static array staticCacheGetPool($cache_pool)

Returns an key/value array with all cached values from the passed pool

Parameters

$cache_pool

Return Value

array

in StaticCacheTrait at line 34
static bool staticCacheIsEnabled()

No description

Return Value

bool

in StaticCacheTrait at line 85
static bool staticCacheIsSet($key, string $cache_pool = 'default')

Checks if the passed is key has a value set

Parameters

$key
string $cache_pool

Return Value

bool

in StaticCacheTrait at line 73
static staticCacheRemove($key, string $cache_pool = 'default')

Removes the passed key

Parameters

$key
string $cache_pool

in StaticCacheTrait at line 46
static void staticCacheSet(string|int $key, mixed $value, string $cache_pool = 'default')

Store a value in the static cache

Parameters

string|int $key
mixed $value
string $cache_pool

ID for the cache pool which should be used

Return Value

void

in Model at line 1675
stop_temporary_group_id_overwrite()

Stops the temporary overwrite of the table_group_id

in Model at line 1657
void temporarily_disable_table_group_id()

Temporarily disable the use of the group ID in all queries made

Return Value

void

in Model at line 1583
string to_json()

Returns the model as JSON array

Return Value

string

Returns model string

in Model at line 1594
string to_string()

Returns the model as STRING

Return Value

string

Returns model as string

in Model at line 1536
string to_xml(array|bool $property_filter = false, bool|DOMDocument $doc = false, DOMElement $parent_element = null)

Returns an XML of all model properties

Parameters

array|bool $property_filter

if given, only the properties in this array are added

bool|DOMDocument $doc

used from model_collection to add this model to an existing structure

DOMElement $parent_element

to add this model as Child, necessary if doc is given

Return Value

string

Returns formatted XML string

in Model at line 1843
void touchProperty($propertyName)

No description

Parameters

$propertyName

Return Value

void

in AuditableTrait at line 59
triggerAuditEvent(Model $model, string $eventKey = AuditableInterface::OBSERVE_EVENT_SAVE)

TBD: Move this method to the audit model? and keep things slim in trait?

Parameters

Model $model
string $eventKey

Exceptions

AuditException

in ScopesTrait at line 56
ModelCollection unscope(string $scopeName = null, Query|null $scopeQuery = null)

Returns an unscoped Collection

Parameters

string $scopeName
Query|null $scopeQuery

Provide a specific Query Object you want to unscope

Return Value

ModelCollection

static object unserializeObject(SerializedObjectHelper $SerializedObjectHelper)

No description

Parameters

SerializedObjectHelper $SerializedObjectHelper

Return Value

object

Exceptions

ReflectionException

static object unserializeObjectFromJSON(string $json)

No description

Parameters

string $json

Return Value

object

Exceptions

JsonException
ReflectionException

at line 215
static updateIndexCache(array $indexes)

No description

Parameters

array $indexes

at line 1974
DocumentIndexReferenceCollection updateReferences(DocumentIndexCollection $documentIndexCollection, int $type = 0, string|null $level = null)

No description

Parameters

DocumentIndexCollection $documentIndexCollection
int $type
string|null $level

Return Value

DocumentIndexReferenceCollection

at line 1393
bool update_details(DocumentModel $documentModel = null)

Update the document index with the details from the referenced document model

Parameters

DocumentModel $documentModel

Return Value

bool

Exceptions

Exception

in SortTrait at line 43
protected int update_sort(mixed $id = false, string $direction = 'up', int $steps = 1, array $params = array())

Update the sort property for a given table (Move a record up/down)

Parameters

mixed $id

(The record ID you intend to move )

string $direction

(The direction you want the record to move)

int $steps

(The amount of steps you want the record to move)

array $params

key 'filter' optional conditions passed as a key-value array. Key 'order_by' additional ORDER string append to ORDER BY sort

Return Value

int

new Sort Value

in Model at line 1081
string|true validate(array $fieldErrors)

No description

Parameters

array $fieldErrors

Field Errors can be returned via reference as array(array('field'=>$field, 'err_msg'=>$error)) or array($field => $error)

Return Value

string|true

TRUE if everything is correct, String for Error-Message

in SoftDeleteTrait at line 59
ModelCollection withDeleted()

No description

Return Value

ModelCollection