Menu

## SeedDMS_Core_Attribute
in package

inc.ClassAttribute.php : 32

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.
__getParsedValue() : string
  Return attribute value parsed into a php type or object
getAttributeDefinition() : object
  Get definition of attribute
getDMS() : object
  Get dms of attribute
getID() : int
  Get internal id of attribute
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

inc.ClassAttribute.php : 53
`protected SeedDMS_Core_AttributeDefinition $_attrdef`

definition of this attribute

##### Tags

access

  protected

#### $_dms

inc.ClassAttribute.php : 74
`protected SeedDMS_Core_DMS $_dms`

reference to the dms instance this attribute belongs to

##### Tags

access

  protected

#### $_id

inc.ClassAttribute.php : 38
`protected int $_id`

id of attribute

##### Tags

access

  protected

#### $_obj

inc.ClassAttribute.php : 46
`protected SeedDMS_Core_Folder|SeedDMS_Core_Document|SeedDMS_Core_DocumentContent $_obj`

SeedDMS_Core_Object folder, document or document content this attribute belongs to

##### Tags

access

  protected

#### $_validation_error

inc.ClassAttribute.php : 67
`protected int $_validation_error`

validation error

##### Tags

access

  protected

#### $_value

inc.ClassAttribute.php : 60
`protected mixed $_value`

value of this attribute

##### Tags

access

  protected

### Methods

#### __construct()

inc.ClassAttribute.php : 83

SeedDMS_Core_Attribute constructor.

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

##### Parameters

$id :
$obj :
$attrdef :
$value :

#### __getParsedValue()

inc.ClassAttribute.php : 135

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.

DEPRECATED

##### Return values

string —

the attribute value as it is stored in the database.

#### getAttributeDefinition()

inc.ClassAttribute.php : 275

Get definition of attribute

`public getAttributeDefinition() : object`

##### Return values

object —

attribute definition

#### getDMS()

inc.ClassAttribute.php : 106

Get dms of attribute

`public getDMS() : object`

##### Return values

object —

$dms

#### getID()

inc.ClassAttribute.php : 113

Get internal id of attribute

`public getID() : int`

##### Return values

int —

id

#### getValidationError()

inc.ClassAttribute.php : 261

Get validation error from last validation

`public getValidationError() : int`

##### Return values

int —

error code

#### getValue()

inc.ClassAttribute.php : 123

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

inc.ClassAttribute.php : 160

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

inc.ClassAttribute.php : 167
`public getValueAsString() : mixed`

#### setDMS()

inc.ClassAttribute.php : 97

Set reference to dms

`public setDMS(SeedDMS_Core_DMS $dms) : mixed`

##### Parameters

$dms : SeedDMS_Core_DMS

#### setValidationError()

inc.ClassAttribute.php : 268

Set validation error

`public setValidationError(mixed $error) : mixed`

##### Parameters

$error : mixed

#### setValue()

inc.ClassAttribute.php : 186

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

inc.ClassAttribute.php : 248

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

## Search results