class Document extends DocumentModel implements ModelWithThumbnail, FullyIntegratedInterface, SearchableDocumentModelInterface, DoclinkableDocumentModelInterface mixin Document

Class XELOS\Modules\SystemDMS\Model\xm_system_dms_document

Traits

Trait Auditable to be used in Models

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

SystemDMSController $mod
protected $model_name

var string Name of this model e.g. category or document

from  Model
protected 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 array $properties
protected array $properties_meta from  Model
protected array $markers from  Model
protected array $properties_null_values 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
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 bool $silent_mode from  DocumentModel
protected array $_update_document_index from  DocumentModel
protected DocumentIndex $documentIndex from  DocumentModel
DocumentIndexReference $rights_context

A document that can be used for accessing this document. Their must either be a reference between the rights_context and the document or the can_read of the document must actually evalute the rights context.

from  DocumentModel
static $rights_cache from  DocumentModel
protected bool $save_as_new_version
protected string $attach_new_file
protected bool $action_logged
DocumentIndex $reference_document_index
DocumentModel|Document $reference_document
DocumentIndexReference $reference_object
bool|int $current_category_id
bool $_load
$action_links

Set with XELOS\Modules\SystemDMS\Model\xm_system_dms_document::attach_document_actions

string $file_extension

Accessible via XELOS\Modules\SystemDMS\Model\xm_system_dms_document::get_file_extension

string $file_path

Accessible via XELOS\Modules\SystemDMS\Model\xm_system_dms_document::get_file_path

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, int|bool $version_id = false)

Constructor

mixed
__get(mixed $var)

No description

from  Model
__isset($name)

No description

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

No description

from  Model
string
__toString()

String Representation of this object (calls for render method)

from  Model
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

mixed
_scopeGroupId(Query $Query)

Applies Group ID Filtering

from  Model
_scope_by(mixed $fn, mixed $parameters)

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

_scope_custom(mixed $fn)

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

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
add_scope_condition(Condition|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
allowIndexProcessingByHooks()

Returns whether the related document index should be processed by hooks or not.

attach_document_actions(bool $icon_only = false, bool $mod = false, string $display = 'link')

Attach action Links for a document Links that would be set on field 'action_links' as array

  • lock
  • delete (only if policy matches)
  • edit (only if policy matches)
  • detail
  • download

bool
attach_file(string $fs_path, bool $move = false, string $target_filename = null)

No description

bool
can_delete(int $category_id = null)

Returns if current User can delete this Document

bool
can_read(int $category_id = null, bool $return_system_folders = false)

Checks if current User can read this Document

bool
can_read_comments()

Returns whether this model should allow related comments or not. The user can still be denied comments when the comments policy "write" is not given to the user.

bool
can_read_comments_global(bool $return_hidden = false)

Checks whether this model can be commented on.

bool
can_read_global($return_hidden = false)

This function checks wether this document can be read by the logged in user and takes the full hierarchy (parent instances) and all possible rights contexts into account

bool
can_read_global_in_rights_context(DocumentIndexReference|false $rights_context = false)

Evaluates can_read_global inside a specific rights context

bool
can_reference()

Checks whether this document can be linked with read reference.

bool
can_see()

Can see defaults to can_read_global, but can be overridden by supporting modules (e.g. closed group should be visible but not readable)

bool
can_share()

Returns true if this document can be shared with groups or users.

bool
can_write(int $category_id = null)

Checks if current User can write this Document

bool
can_write_global($return_hidden = false)

This function checks wether this document can be read by the logged in user and takes the full hierarchy (parent instances) and all possible rights contexts into account

bool
can_write_global_in_rights_context(DocumentIndexReference $rights_context)

Evaluates can_write_global inside a specific rights context

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
array
convert_array_to_conditions(array $params = array())

Convert Assoc Multidimensional Array to Model Conditional Array

from  Model
int
count_all()

Returns the count of all models

from  Model
Model[]
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
string|void
debug(bool $show_markers = false, int $mode = 0)

No description

from  Model
bool
delete(bool $trash = true)

Delete Document

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_silent_mode()

Disables the silent mode Objects in silent mode do not cause document index job queues, thus saving them is much more performant but does not update the search index, the wall or other similar system modules

void
disable_table_group_id()

Disable the use of the group ID in all queries made

from  Model
void
enable_silent_mode()

Sets the silent mode to true Objects in silent mode do not cause document index job queues, thus saving them is much more performant but does not update the search index, the wall or other similar system modules

void
enable_table_group_id()

Enable the use of the group ID in all queries made

from  Model
mixed
find(string $mode = 'all', mixed $conditions = false, mixed $query_params = false)

Find Function to find models using the passed condition

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

Returns loaded ModelCollection

from  Model
Document[]
find_all_by_category_id(array $available_category_ids, array $array)

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
find_by_id_and_category_id(mixed $document_id, int $id)

No description

Document|bool
find_by_id_and_group_id(mixed $id, mixed $group_id, mixed $query_params)

No description

find_by_xfs_path(string $CATEGORY_ICON_PATH)

No description

functionNameToQuery(string $query, array $parameters)

Converts a findby* function name to SQL query.

from  Model
string
generate_file_path(mixed $version = 'current', bool|string $overwrite_filename = false, bool $old_revision_fallback = false)

No description

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
getBasePath()

No description

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()

Get DB Schema if available

from  Model
getMod()

No description

getModelCollection()

Return a new unscoped model collection for further processing

from  Model
Preview|null
getPreview($type)

No description

array
getPreviewFiles()

Get Preview Files if available for this document

string
getPreviewStoragePath()

No description

array
getPropertyMarkers(bool $value_discovery = true)

Return properties and markers

from  Model
DocumentModel|null
getReferenceDocument()

No description

DocumentIndex|null
getReferenceDocumentIndex()

No description

getScopeQuery()

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

string
getScopeQueryConditionSQL()

Returns the WHERE SQL Conditions based on the current Condition Separate function to be able to update scopes at this point in time if needed

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
string
get_author()

Returns the author name of the current document

get_cf()

Return the cf library for this model type

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
get_document_index()

Returns the related document index.

get_document_registry_info()

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

get_document_tmp_folder()

Returns the path for this documents storage path This folder is automatically cleared when the document is removed

get_documents_by_category(int $category, bool $return_objects = true, bool|string $filter = false, bool $hasSecurityCheck = true)

Returns all document objects of the passed category

array
get_documents_by_search(int $query, bool $return_objects = true, array $search_params = [], int $limit = 200)

Returns all document objects with the passed tag

string
get_download_link(int $limit = 25, bool $icon = true)

No description

string
get_download_link_full(bool $icon = true)

Return a download link to the corresponding file

bool|string
get_download_url()

No description

string
get_file_base_path(bool $force_this = false)

No description

string
get_file_extension()

Check for the current File-Extension

string
get_file_path()

Returns the file path of this or the reference document.

string
get_file_path_relative(string $version = 'current')

No description

bool|string
get_file_url(mixed $version = null, bool $inline_disposition = true)

Get File Download URL

int
get_filemtime()

Returns the time the file was last modified. The time is returned as a Unix timestamp, which is suitable for the date() function.

string
get_filename_url()

gets the url-friendly filename

string
get_filename_without_extension()

Check for the current FileName without Extension

int
get_filesize()

gets the filesize in Bytes for the current file

array
get_formatted_data(bool $xoi_dialog = false)

If a template is used for this document, the values are formatted.

null
get_from_rights_cache(DocumentModel $document, string $right)

No description

Document[]|int[]
get_history(bool $return_objects = true, int $limit = null)

Returns a list with all versioned document objects

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

Return the property translated property value if available

from  Model
string
get_icon_class()

No description

int
get_latest_version_id()

No description

xm_webdav_lock|bool
get_lock()

Get the lock of the referenced document

string
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
array|false
get_preview_pages(mixed $page_count, bool $force_new = false, bool $cache_only = true)

Generates the preview pages and returns them

array
get_properties(bool $value_discovery = true)

Returns the complete properties array

from  Model
array
get_properties_meta(bool|string $field = false)

No description

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

No description

from  Model
Category|bool
get_related_category()

No description

static mixed|null
get_request_cache(string $key)

Return Cache Entry if it exists

from  Model
bool
get_silent_mode()

Returns if the silent mode is currently active Objects in silent mode do not cause document index job queues, thus saving them is much more performant but does not update the search index, the wall or other similar system modules

string
get_table_name()

Returns the table name of this model.

from  Model
string
get_table_primary_key()

No description

from  Model
string
get_thumb_url(int $width = 100, int $height = 100)

Returns an url to the thumb of this document if available

string
get_thumb_url_if_set()

No description

string|int
get_thumbnail_document(bool $force_new = false)

No description

string
get_updated_at_formatted()

Return a Formatted DateTime

from  Model
string
get_version_download_url(int $version_id)

No description

mixed|string
get_version_string()

No description

string
get_webdav_url()

No description

get_xui_document()

Get XUI Document Representation

void
handle_reference_delete(DocumentIndexReference $reference, $user_id = null)

No description

bool
hasChangedProperties()

No description

from  Model
bool
hasTouchedProperties()

No description

from  Model
init(bool $auto_load = true)

Initialization

initAuditableTrait()

Init Method

bool
isAuditingEnabled()

Determine whether auditing is enabled.

bool
is_locked()

Check if referenced document is locked

bool
is_mime_type($type)

Checks if the mime type of this document matches the given mime type.

bool
is_name_in_category()

Checks if the current document has a NAME-duplicate in its Category (Important for webDav-Listing) A Duplicate must have the same File-Extension, too.

load()

Loads the document.

void
loadReferenceDocument()

Loads the reference document and saves internally as property.

bool
load_from_db(string $table_name, array|bool $key_fields = false)

No description

from  Model
mixed
load_meta_data()

Returns the meta data for this document Wrapped in a public method to allow forwarding that request to link targets in the future

bool
lock()

Lock the referenced document

bool
match_mime_types($types)

Checks if the mime type of this document matches one of the given mime types.

onSearchIndexUpdate(SearchIndexRecord $baseIndexRecord)

No description

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
bool
preventPresentationAfterIndexing()

Returns whether this document should be present to user (e.g. activity stream/log) after an indexing process or not.

array
process_find_query(mixed $select_field, mixed $query_params)

Execute Query of find() function. Can be modified by child class if necessary

from  Model
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
remove_document_index()

removes index-entry of this model (only marking to delete).

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

No description

bool
rename(string $new_filename, bool $rename_name = true)

Rename Filename Do not currently update the file_path

null
render()

No description

resolve_document_id(string $document_id)

Resolve Combined IDs to a single document

resolve_rights_context(null|string $right = null, bool $apply = false)

Loads the rights context by checking all possible rights context and return it without apply on this model.

int|bool
save(bool $save_raw = false, bool $skip_category_notification = false, bool $skip_search_index_update = false)

Save document to database

int|bool
save_meta_data(mixed $meta)

Writes the meta data to the database Wrapped in a public method to allow forwarding this request to link targets in the future

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
scopeAll()

No description

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

Returns unloaded ModelCollection

from  Model
bool
secureFile()

auto-renames filename and document-name triggered from save()

void
self() $this find_by_id($id)

No description

from  Model
setDocumentIndex(DocumentIndex $documentIndex)

Sets the related document index.

void
setModelCollectionReference(ModelCollection $modelCollectionReference)

No description

set_filename(string $filename)

Will set the filename url-friendly and without any path-information IMPORTANT: do not use the current model-set-methods it will not rename the files proper

set_model_default_render_xui(string $model_default_render_xui)

No description

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

No description

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

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
null
set_to_rights_cache(DocumentModel $document, string $right, $value)

No description

string
set_uploaded_file(array $FILE)

Handler for uploading files (should be attached as upload_callback to the corresponding form)

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)

start_new_version($auto_minor_change = false)

Starts a new version (will be saved when save() is called)

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
void
temporarily_enable_table_group_id()

Temporarily enables 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
triggerAuditEvent(Model $model, string $eventKey = AuditableInterface::OBSERVE_EVENT_SAVE)

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

bool
unlock()

Remove all locks from the referenced document

unscope($scopeName = false)

Removes all scopes (including Default Scopes)

update()

Updates properties.

bool
update_document_index(string $status = IndexEventInterface::EVENT_UPDATE)

updates the related index-item for itself (not global, only for this 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)

Validate Function for Forms with Document-Models as Target

Details

in Model at line 994
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 1544
__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, int|bool $version_id = false)

Constructor

Parameters

int|bool $id

Primary ID of the model which should be loaded

int|bool $version_id

Version-ID

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

No description

Parameters

mixed $var

Return Value

mixed

in Model at line 1601
__isset($name)

No description

Parameters

$name

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

No description

Parameters

mixed $var
mixed $value

Return Value

mixed

in Model at line 1553
string __toString()

String Representation of this object (calls for render method)

Return Value

string

in Model at line 1032
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 81
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 90
Query _scopeDefault(Query $Query)

Load default scopes

Parameters

Query $Query

Return Value

Query

in Model at line 1489
protected mixed _scopeGroupId(Query $Query)

Applies Group ID Filtering

Parameters

Query $Query

Return Value

mixed

in ScopesTrait at line 119
protected ModelCollection _scope_by(mixed $fn, mixed $parameters)

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

Parameters

mixed $fn
mixed $parameters

Return Value

ModelCollection

in ScopesTrait at line 132
protected ModelCollection _scope_custom(mixed $fn)

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

Parameters

mixed $fn

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

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

in Model at line 823
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

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

Adds a condition to scope the following find functions

Parameters

Condition|Query|string $new_condition

Return Value

ModelCollection

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

Return all models

Parameters

mixed $params

Return Value

Model[]

in DocumentModel at line 880
bool allowIndexProcessingByHooks()

Returns whether the related document index should be processed by hooks or not.

Return Value

bool

at line 1609
attach_document_actions(bool $icon_only = false, bool $mod = false, string $display = 'link')

Attach action Links for a document Links that would be set on field 'action_links' as array

  • lock
  • delete (only if policy matches)
  • edit (only if policy matches)
  • detail
  • download

Parameters

bool $icon_only
bool $mod
string $display

at line 784
bool attach_file(string $fs_path, bool $move = false, string $target_filename = null)

No description

Parameters

string $fs_path
bool $move
string $target_filename

Return Value

bool

at line 1383
bool can_delete(int $category_id = null)

Returns if current User can delete this Document

Parameters

int $category_id

Category-ID. if unset then use current Category-ID of Document

Return Value

bool

at line 1315
bool can_read(int $category_id = null, bool $return_system_folders = false)

Checks if current User can read this Document

Parameters

int $category_id

Category-ID. if unset then use current Category-ID of Document

bool $return_system_folders

Return Value

bool

in DocumentModel at line 392
bool can_read_comments()

Returns whether this model should allow related comments or not. The user can still be denied comments when the comments policy "write" is not given to the user.

Return Value

bool

TRUE if this model can be commented, false if not.

in DocumentModel at line 404
final bool can_read_comments_global(bool $return_hidden = false)

Checks whether this model can be commented on.

Parameters

bool $return_hidden

Return Value

bool

See also

can_read_comments

in DocumentModel at line 329
final bool can_read_global($return_hidden = false)

This function checks wether this document can be read by the logged in user and takes the full hierarchy (parent instances) and all possible rights contexts into account

Parameters

$return_hidden

bool Flags if hidden elements may be returned or not

Return Value

bool

in DocumentModel at line 376
bool can_read_global_in_rights_context(DocumentIndexReference|false $rights_context = false)

Evaluates can_read_global inside a specific rights context

Parameters

DocumentIndexReference|false $rights_context

The rights context for which to check the access rights

Return Value

bool

in DocumentModel at line 743
bool can_reference()

Checks whether this document can be linked with read reference.

This method also considers the group context and parent context of the mod owns this document to apply module specific reference policies.

Return Value

bool

in DocumentModel at line 718
bool can_see()

Can see defaults to can_read_global, but can be overridden by supporting modules (e.g. closed group should be visible but not readable)

Return Value

bool

in DocumentModel at line 451
bool can_share()

Returns true if this document can be shared with groups or users.

This method can be overridden by subclass.

Return Value

bool

at line 1340
bool can_write(int $category_id = null)

Checks if current User can write this Document

Parameters

int $category_id

Category-ID. if unset then use current Category-ID of Document

Return Value

bool

in DocumentModel at line 461
final bool can_write_global($return_hidden = false)

This function checks wether this document can be read by the logged in user and takes the full hierarchy (parent instances) and all possible rights contexts into account

Parameters

$return_hidden

bool Flags if hidden elements may be returned or not

Return Value

bool

in DocumentModel at line 494
bool can_write_global_in_rights_context(DocumentIndexReference $rights_context)

Evaluates can_write_global inside a specific rights context

Parameters

DocumentIndexReference $rights_context

The rights context for which to check the access rights

Return Value

bool

in Model at line 1051
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 567
clear_properties()

No description

in Model at line 1228
array convert_array_to_conditions(array $params = array())

Convert Assoc Multidimensional Array to Model Conditional Array

Parameters

array $params

['id'=>1,'type'=>'active']

Return Value

array

["id = 1","type = 'active'"]

in Model at line 36
int count_all()

Returns the count of all models

Return Value

int

in Model at line 36
Model[] 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

Model[]

in Model at line 808
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 437
bool delete(bool $trash = true)

Delete Document

Parameters

bool $trash

Trash mode enabled

Return Value

bool

was delete successful?

in Model at line 36
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 DocumentModel at line 68
void disable_silent_mode()

Disables the silent mode Objects in silent mode do not cause document index job queues, thus saving them is much more performant but does not update the search index, the wall or other similar system modules

Return Value

void

in Model at line 1497
void disable_table_group_id()

Disable the use of the group ID in all queries made

Return Value

void

in DocumentModel at line 57
void enable_silent_mode()

Sets the silent mode to true Objects in silent mode do not cause document index job queues, thus saving them is much more performant but does not update the search index, the wall or other similar system modules

Return Value

void

in Model at line 1520
void enable_table_group_id()

Enable the use of the group ID in all queries made

Return Value

void

in Model at line 1094
mixed find(string $mode = 'all', mixed $conditions = false, mixed $query_params = false)

Find Function to find models using the passed condition

Parameters

string $mode

Find mode (all/first/count)

mixed $conditions

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

mixed $query_params

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

Return Value

mixed

by_mode [ ALL: ModelCollection; FIRST: Model | boolean false on fail ]

in Model at line 36
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 43
Document[] find_all_by_category_id(array $available_category_ids, array $array)

No description

Parameters

array $available_category_ids
array $array

Return Value

Document[]

in Model at line 36
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 43
Document find_by_id_and_category_id(mixed $document_id, int $id)

No description

Parameters

mixed $document_id
int $id

Return Value

Document

at line 43
Document|bool find_by_id_and_group_id(mixed $id, mixed $group_id, mixed $query_params)

No description

Parameters

mixed $id
mixed $group_id
mixed $query_params

Return Value

Document|bool

at line 43
Document find_by_xfs_path(string $CATEGORY_ICON_PATH)

No description

Parameters

string $CATEGORY_ICON_PATH

Return Value

Document

in Model at line 1286
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

at line 1406
string generate_file_path(mixed $version = 'current', bool|string $overwrite_filename = false, bool $old_revision_fallback = false)

No description

Parameters

mixed $version

FILEVERSION: default string 'current' or explicit int version_id (not used yet)

bool|string $overwrite_filename
bool $old_revision_fallback

Return Value

string

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 2344
string getBasePath()

No description

Return Value

string

in Model at line 1685
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 839
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 eturns a model collection

in Model at line 187
array getDBSchema()

Get DB Schema if available

Return Value

array

in DocumentModel at line 46
Controller getMod()

No description

Return Value

Controller

in Model at line 1066
ModelCollection getModelCollection()

Return a new unscoped model collection for further processing

Return Value

ModelCollection

at line 2069
Preview|null getPreview($type)

No description

Parameters

$type

Return Value

Preview|null

at line 2053
array getPreviewFiles()

Get Preview Files if available for this document

Return Value

array

['images'=>[(string) $path1, (string) $path2],'pdf'=> (string) $path3]

at line 2351
string getPreviewStoragePath()

No description

Return Value

string

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

Return properties and markers

Parameters

bool $value_discovery

Return Value

array

at line 2221
DocumentModel|null getReferenceDocument()

No description

Return Value

DocumentModel|null

at line 2229
DocumentIndex|null getReferenceDocumentIndex()

No description

Return Value

DocumentIndex|null

in ScopesTrait at line 212
Query getScopeQuery()

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

Return Value

Query

in ScopesTrait at line 202
protected string getScopeQueryConditionSQL()

Returns the WHERE SQL Conditions based on the current Condition Separate function to be able to update scopes at this point in time if needed

Return Value

string

in Model at line 1666
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']

at line 864
string get_author()

Returns the author name of the current document

Return Value

string

display name or boolean false on fail

in DocumentModel at line 830
DocumentItem get_cf()

Return the cf library for this model type

Return Value

DocumentItem

The content first library

in Model at line 1472
string get_created_at_formatted()

Return a Formatted DateTime

Return Value

string

in Model at line 479
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'=>'']

in DocumentModel at line 119
DocumentIndex|null get_document_index()

Returns the related document index.

Return Value

DocumentIndex|null

in DocumentModel at line 774
DocumentRegistry 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

in DocumentModel at line 218
get_document_tmp_folder()

Returns the path for this documents storage path This folder is automatically cleared when the document is removed

at line 1004
Document[]|ModelCollection get_documents_by_category(int $category, bool $return_objects = true, bool|string $filter = false, bool $hasSecurityCheck = true)

Returns all document objects of the passed category

Parameters

int $category

Category ID

bool $return_objects
bool|string $filter

Additional string used to filter by document name or filename

bool $hasSecurityCheck

Used when documents are needed for name/filename duplicate check before the parent Document/Model is saved

Return Value

Document[]|ModelCollection

Array with all document objects

Returns all document objects with the passed tag

Parameters

int $query

Category-ID

bool $return_objects
array $search_params
int $limit

Return Value

array

Array with all document objects

No description

Parameters

int $limit

limit of string-size

bool $icon

Return Value

string

Link-Return Array or string with error-message on fail

Return a download link to the corresponding file

Parameters

bool $icon

Return Value

string

Link-Return Array or string with error-message on fail

at line 969
bool|string get_download_url()

No description

Return Value

bool|string

at line 1474
string get_file_base_path(bool $force_this = false)

No description

Parameters

bool $force_this

Return Value

string

at line 830
string get_file_extension()

Check for the current File-Extension

Return Value

string

File-Extension

at line 1494
string get_file_path()

Returns the file path of this or the reference document.

Return Value

string

at line 1449
string get_file_path_relative(string $version = 'current')

No description

Parameters

string $version

Return Value

string

at line 1850
bool|string get_file_url(mixed $version = null, bool $inline_disposition = true)

Get File Download URL

Parameters

mixed $version
bool $inline_disposition

Return Value

bool|string

at line 895
int get_filemtime()

Returns the time the file was last modified. The time is returned as a Unix timestamp, which is suitable for the date() function.

Return Value

int

Unix timestamp or FALSE on failure

at line 847
string get_filename_url()

gets the url-friendly filename

Return Value

string

URL-encoded string according to RFC 1738

at line 813
string get_filename_without_extension()

Check for the current FileName without Extension

Return Value

string

Basic File-Name

at line 876
int get_filesize()

gets the filesize in Bytes for the current file

Return Value

int

filesize in Bytes

at line 916
array get_formatted_data(bool $xoi_dialog = false)

If a template is used for this document, the values are formatted.

Parameters

bool $xoi_dialog

Is this method called in the XOI sidebar? External links have to be formatted differently

Return Value

array

array of array('label' => Label in Template, 'value' => formatted value)

in DocumentModel at line 279
null get_from_rights_cache(DocumentModel $document, string $right)

No description

Parameters

DocumentModel $document
string $right

e.g. read

Return Value

null

at line 1152
Document[]|int[] get_history(bool $return_objects = true, int $limit = null)

Returns a list with all versioned document objects

Parameters

bool $return_objects

Return Objects or IDs

int $limit

limit of returning Items (boolean false for no limit)

Return Value

Document[]|int[]

array(XELOS\Modules\SystemDMS\Model\xm_system_dms_document) or array(int)

in Model at line 1642
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 2237
string get_icon_class()

No description

Return Value

string

at line 168
int get_latest_version_id()

No description

Return Value

int

at line 1895
xm_webdav_lock|bool get_lock()

Get the lock of the referenced document

Return Value

xm_webdav_lock|bool

in Model at line 317
string get_model_name()

Returns the SQL table of this model (if available)

Return Value

string

Full qualified table name e.g. xmi_crm01_contact

in Model at line 296
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 2086
array|false get_preview_pages(mixed $page_count, bool $force_new = false, bool $cache_only = true)

Generates the preview pages and returns them

Parameters

mixed $page_count
bool $force_new

Regenerate Preview even if it already exists (Automatically se

bool $cache_only

Return Value

array|false

in Model at line 430
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 466
array get_properties_meta(bool|string $field = false)

No description

Parameters

bool|string $field

if given returns the meta for that field

Return Value

array

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

No description

Parameters

string $property_id

Marker ID

bool $get_raw_value

deactivate Marker-Function gets triggered

Return Value

mixed

Marker Content

No description

Return Value

Category|bool

XELOS\Modules\SystemDMS\Model\xm_system_dms_category: on success; boolean: false on fail

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

Return Cache Entry if it exists

Parameters

string $key

Cache Key

Return Value

mixed|null

in DocumentModel at line 79
bool get_silent_mode()

Returns if the silent mode is currently active Objects in silent mode do not cause document index job queues, thus saving them is much more performant but does not update the search index, the wall or other similar system modules

Return Value

bool

in Model at line 287
string get_table_name()

Returns the table name of this model.

Return Value

string

in Model at line 309
string get_table_primary_key()

No description

Return Value

string

Primary Key Field in DB

at line 2036
string get_thumb_url(int $width = 100, int $height = 100)

Returns an url to the thumb of this document if available

Parameters

int $width
int $height

Return Value

string

at line 2044
string get_thumb_url_if_set()

No description

Return Value

string

at line 2143
string|int get_thumbnail_document(bool $force_new = false)

No description

Parameters

bool $force_new

Should generation of thumbnail be enforced (thumbnail should be generated new)

Return Value

string|int

Absolute path to resizable image (JPG, PNG) or System Document Index ID

in Model at line 1481
string get_updated_at_formatted()

Return a Formatted DateTime

Return Value

string

at line 2262
string get_version_download_url(int $version_id)

No description

Parameters

int $version_id

document_history

Return Value

string

$url

at line 2272
mixed|string get_version_string()

No description

Return Value

mixed|string

at line 1559
string get_webdav_url()

No description

Return Value

string

link for direct webdav access

in DocumentModel at line 800
Document get_xui_document()

Get XUI Document Representation

Return Value

Document

at line 240
void handle_reference_delete(DocumentIndexReference $reference, $user_id = null)

No description

Parameters

DocumentIndexReference $reference
$user_id

Return Value

void

in Model at line 1696
bool hasChangedProperties()

No description

Return Value

bool

in Model at line 1673
bool hasTouchedProperties()

No description

Return Value

bool

at line 120
init(bool $auto_load = true)

Initialization

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 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 1881
bool is_locked()

Check if referenced document is locked

Return Value

bool

at line 1546
bool is_mime_type($type)

Checks if the mime type of this document matches the given mime type.

Parameters

$type

Return Value

bool

at line 1277
bool is_name_in_category()

Checks if the current document has a NAME-duplicate in its Category (Important for webDav-Listing) A Duplicate must have the same File-Extension, too.

Return Value

bool

at line 176
load()

Loads the document.

at line 2204
protected void loadReferenceDocument()

Loads the reference document and saves internally as property.

Return Value

void

in Model at line 698
protected bool load_from_db(string $table_name, array|bool $key_fields = false)

No description

Parameters

string $table_name

Table Name

array|bool $key_fields

Key fields which should be used as WHERE condition

Return Value

bool

at line 614
mixed load_meta_data()

Returns the meta data for this document Wrapped in a public method to allow forwarding that request to link targets in the future

Return Value

mixed

An assoc array of all meta data

at line 1930
bool lock()

Lock the referenced document

Return Value

bool

at line 1530
bool match_mime_types($types)

Checks if the mime type of this document matches one of the given mime types.

Parameters

$types

Return Value

bool

at line 2279
SearchIndexRecord onSearchIndexUpdate(SearchIndexRecord $baseIndexRecord)

No description

Parameters

SearchIndexRecord $baseIndexRecord

Return Value

SearchIndexRecord

in Model at line 932
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)

in DocumentModel at line 890
bool preventPresentationAfterIndexing()

Returns whether this document should be present to user (e.g. activity stream/log) after an indexing process or not.

Return Value

bool

in Model at line 1246
protected array process_find_query(mixed $select_field, mixed $query_params)

Execute Query of find() function. Can be modified by child class if necessary

Parameters

mixed $select_field
mixed $query_params

Return Value

array

dbquery Result

in ScopesTrait at line 105
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 160
reload_schema()

Reloads the schema of the model

in DocumentModel at line 205
final remove_document_index()

removes index-entry of this model (only marking to delete).

the real delete operation will be triggered by the document_index_deamon. (will be automatically trigged at: DocumentModel->delete())

Exceptions

AuditException

in DocumentModel at line 234
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

Exceptions

Exception

at line 719
bool rename(string $new_filename, bool $rename_name = true)

Rename Filename Do not currently update the file_path

Parameters

string $new_filename

Filename

bool $rename_name

Rename doc name too

Return Value

bool

at line 154
null render()

No description

Return Value

null

at line 2178
Document resolve_document_id(string $document_id)

Resolve Combined IDs to a single document

Parameters

string $document_id

$categoryid.''.$document_id (where category_id can also be combined)

Return Value

Document

DMS Document or FALSE on failure

in DocumentModel at line 687
mixed|DocumentIndexReference resolve_rights_context(null|string $right = null, bool $apply = false)

Loads the rights context by checking all possible rights context and return it without apply on this model.

Parameters

null|string $right

Keep empty for read and write or set read or write

bool $apply

Return Value

mixed|DocumentIndexReference

at line 256
int|bool save(bool $save_raw = false, bool $skip_category_notification = false, bool $skip_search_index_update = false)

Save document to database

Parameters

bool $save_raw

dont handle secure filenames

bool $skip_category_notification

Skip Category Notification (Category will not be updated and saved)

bool $skip_search_index_update

Skip Search Index Update (Search Index will not be updated)

Return Value

int|bool

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

at line 654
int|bool save_meta_data(mixed $meta)

Writes the meta data to the database Wrapped in a public method to allow forwarding this request to link targets in the future

Parameters

mixed $meta

An assoc array of all meta data

Return Value

int|bool

Number of inserted meta data rows to the document_meta_data table

in Model at line 584
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 1266
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 14
ModelCollection scopeAll()

No description

Return Value

ModelCollection

in Model at line 36
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[]

at line 557
bool secureFile()

auto-renames filename and document-name triggered from save()

Return Value

bool

$filenameChanged

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

No description

Parameters

) $this find_by_id($id

Return Value

void

in DocumentModel at line 132
setDocumentIndex(DocumentIndex $documentIndex)

Sets the related document index.

Parameters

DocumentIndex $documentIndex

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

No description

Parameters

ModelCollection $modelCollectionReference

Return Value

void

at line 980
set_filename(string $filename)

Will set the filename url-friendly and without any path-information IMPORTANT: do not use the current model-set-methods it will not rename the files proper

Parameters

string $filename

at line 147
set_model_default_render_xui(string $model_default_render_xui)

No description

Parameters

string $model_default_render_xui

in Model at line 550
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

at line 639
set_property(string|array $property_id, string|bool $property_value = false, bool $no_change = false)

No description

Parameters

string|array $property_id

Marker ID (Can also be an Array)

string|bool $property_value

Value

bool $no_change

Value return void

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

Sets parameter that will be passed to the XUI helpers

Parameters

mixed $params

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

Set Request Cache Entry

Parameters

string $key
mixed $value

in DocumentModel at line 306
null set_to_rights_cache(DocumentModel $document, string $right, $value)

No description

Parameters

DocumentModel $document
string $right

e.g. read

$value

Return Value

null

at line 768
string set_uploaded_file(array $FILE)

Handler for uploading files (should be attached as upload_callback to the corresponding form)

Parameters

array $FILE

File

Return Value

string

filename?

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

at line 604
start_new_version($auto_minor_change = false)

Starts a new version (will be saved when save() is called)

Parameters

$auto_minor_change

in Model at line 1536
stop_temporary_group_id_overwrite()

Stops the temporary overwrite of the table_group_id

in Model at line 1511
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 1528
void temporarily_enable_table_group_id()

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

Return Value

void

in Model at line 1444
string to_json()

Returns the model as JSON array

Return Value

string

Returns model string

in Model at line 1455
string to_string()

Returns the model as STRING

Return Value

string

Returns model as string

in Model at line 1397
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 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

at line 1965
bool unlock()

Remove all locks from the referenced document

Return Value

bool

in ScopesTrait at line 49
ModelCollection unscope($scopeName = false)

Removes all scopes (including Default Scopes)

Parameters

$scopeName

string|bool Name of named scope to be removed or FALSE to clear all scopes incl. unnamed scopes (e.g. scope_by)

Return Value

ModelCollection

at line 688
protected update()

Updates properties.

in DocumentModel at line 143
final bool update_document_index(string $status = IndexEventInterface::EVENT_UPDATE)

updates the related index-item for itself (not global, only for this model!)

Parameters

string $status

Defaults to IndexEventInterface::EVENT_UPDATE

Return Value

bool

was saving of index-item successful?

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

at line 530
string|true validate(array $fieldErrors)

Validate Function for Forms with Document-Models as Target

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