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
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
$_attrdef
protected
SeedDMS_Core_AttributeDefinition
$_attrdef
definition of this attribute
Tags
$_dms
protected
SeedDMS_Core_DMS
$_dms
reference to the dms instance this attribute belongs to
Tags
$_id
protected
int
$_id
id of attribute
Tags
$_obj
protected
SeedDMS_Core_Folder|SeedDMS_Core_Document|SeedDMS_Core_DocumentContent
$_obj
SeedDMS_Core_Object folder, document or document content this attribute belongs to
Tags
$_validation_error
protected
int
$_validation_error
validation error
Tags
$_value
protected
mixed
$_value
value of this attribute
Tags
Methods
__construct()
SeedDMS_Core_Attribute constructor.
public
__construct( $id, $obj, $attrdef, $value) : mixed
Parameters
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
getValueAsString()
public
getValueAsString() : mixed
setDMS()
Set reference to dms
public
setDMS(SeedDMS_Core_DMS $dms) : mixed
Parameters
- $dms : SeedDMS_Core_DMS
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