Documentation

SeedDMS_Core_Attribute
in package

Class to represent an attribute in the document management system

Attributes are key/value pairs which can be attachted to documents, folders and document content. The number of attributes is unlimited. Each attribute has a value and is related to an attribute definition, which holds the name and other information about the attribute.

Tags
see
SeedDMS_Core_AttributeDefinition
category

DMS

author

Uwe Steinmann uwe@steinmann.cx

copyright

Copyright (C) 2012-2024 Uwe Steinmann

version

Release: @package_version@

Table of Contents

Properties

$_attrdef  : SeedDMS_Core_AttributeDefinition
$_dms  : SeedDMS_Core_DMS
$_id  : int
$_obj  : SeedDMS_Core_Folder|SeedDMS_Core_Document|SeedDMS_Core_DocumentContent
$_validation_error  : int
$_value  : mixed

Methods

__construct()  : mixed
SeedDMS_Core_Attribute constructor.
getAttributeDefinition()  : object
Get definition of attribute
getDMS()  : object
Get dms of attribute
getID()  : int
Get internal id of attribute
getParsedValue()  : string
Return attribute value parsed into a php type or object
getValidationError()  : int
Get validation error from last validation
getValue()  : string
Return attribute value as stored in database
getValueAsArray()  : array<string|int, mixed>
Return attribute values as an array
getValueAsString()  : mixed
setDMS()  : mixed
Set reference to dms
setValidationError()  : mixed
Set validation error
setValue()  : bool
Set a value of an attribute
validate()  : bool
Validate attribute value

Properties

$_validation_error

protected int $_validation_error

validation error

Tags
access

protected

Methods

__construct()

SeedDMS_Core_Attribute constructor.

public __construct( $id,  $obj,  $attrdef,  $value) : mixed
Parameters
$id :
$obj :
$attrdef :
$value :

getAttributeDefinition()

Get definition of attribute

public getAttributeDefinition() : object
Return values
object

attribute definition

getDMS()

Get dms of attribute

public getDMS() : object
Return values
object

$dms

getID()

Get internal id of attribute

public getID() : int
Return values
int

id

getParsedValue()

Return attribute value parsed into a php type or object

public getParsedValue() : string

This function will return the value of multi value attributes including the separator char.

Return values
string

the attribute value as it is stored in the database.

getValidationError()

Get validation error from last validation

public getValidationError() : int
Return values
int

error code

getValue()

Return attribute value as stored in database

public getValue() : string

This function will return the value of multi value attributes including the separator char.

Return values
string

the attribute value as it is stored in the database.

getValueAsArray()

Return attribute values as an array

public getValueAsArray() : array<string|int, mixed>

This function returns the attribute value as an array. The array has one element for non multi value attributes and n elements for multi value attributes.

Return values
array<string|int, mixed>

the attribute values

setValidationError()

Set validation error

public setValidationError(mixed $error) : mixed
Parameters
$error : mixed

setValue()

Set a value of an attribute

public setValue(string $values) : bool

The attribute is completely deleted if the value is an empty string or empty array. An array of values is only allowed if the attribute may have multiple values. If an array is passed and the attribute may have only a single value, then the first element of the array will be taken.

Parameters
$values : string

value as string or array to be set

Return values
bool

true if operation was successfull, otherwise false

validate()

Validate attribute value

public validate() : bool

This function checks if the attribute values fits the attribute definition. If the validation fails the validation error will be set which can be requested by SeedDMS_Core_Attribute::getValidationError()

Return values
bool

true if validation succeeds, otherwise false


        
On this page

Search results