Omeka_Record_Builder_AbstractBuilder

class Omeka_Record_Builder_AbstractBuilder

Package: Record\Builder

Build or update an {@link Omeka_Record_AbstractRecord} as needed.

property _recordClass

Class of record that the builder will create.

property _settableProperties

String names denoting the properties of a specific record that can be set directly through the builder. This will not always be all of the fields for the record.

property _metadataOptions

Parsed metadata options for the builder.

property _record

Record being built or updated.

property _db
__construct(Omeka_Db $db)
Parameters:
build()

Build the actual record. If the record already exists, update it as necessary.

Returns:Omeka_Record_AbstractRecord
setRecordMetadata(array $metadata)

Set basic metadata for the record.

Note that the columns to be set must be specified in the $_settablePropertiesproperty of subclassed Builders.

Parameters:
  • $metadata (array) –
Returns:

void

getRecordMetadata()

Get the metadata that will be saved to the record.

Returns:array
getRecord()

Get the record that is being acted upon by the builder.

When an Omeka_Record_AbstractRecord instance has been provided viasetRecord(), that will be returned. If a record ID has been provided,then the appropriate record will be returned.

Otherwise, a new instance of Omeka_Record_AbstractRecord will be returned.

Returns:Omeka_Record_AbstractRecord
setRecord(Omeka_Record_AbstractRecord|integer|null $record)

Set the record upon which this builder will act.

Parameters:
  • $record (Omeka_Record_AbstractRecord|integer|null) –
Returns:

void

_beforeBuild(Omeka_Record_AbstractRecord $record)

All necessary tasks to take place before the record is inserted.

Exceptions may be thrown, validation errors may be added.

Parameters:
Returns:

void

_afterBuild(Omeka_Record_AbstractRecord $record)

All necessary tasks that take place after the record has been inserted into the database.

Should not throw exceptions in this method.

Parameters:
Returns:

void

_setRecordProperties(Omeka_Record_AbstractRecord $record)

Set the properties for the record, taking care to filter based on the $_settableProperties array.

Parameters:
Returns:

void