Omeka_Record_Builder_AbstractBuilder
Package: Record\Builder
- class Omeka_Record_Builder_AbstractBuilder
Build or update an {@link Omeka_Record_AbstractRecord} as needed.
- property _recordClass
protected string
Class of record that the builder will create.
- property _settableProperties
protected array
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 _record
protected Omeka_Record_AbstractRecord
Record being built or updated.
- property _db
protected Omeka_Db
- build()
Build the actual record. If the record already exists, update it as necessary.
- Returns:
Omeka_Record_AbstractRecord
- setRecordMetadata($metadata)
Set basic metadata for the record.
Note that the columns to be set must be specified in the $_settableProperties property of subclassed Builders.
- Parameters:
$metadata (
array
) –
- 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 via setRecord(), 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($record = null)
Set the record upon which this builder will act.
- Parameters:
$record (
Omeka_Record_AbstractRecord|int|null
) –
- _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:
$record (
Omeka_Record_AbstractRecord
) –
- _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:
$record (
Omeka_Record_AbstractRecord
) –
- _setRecordProperties($record)
Set the properties for the record, taking care to filter based on the $_settableProperties array.
- Parameters:
$record (
Omeka_Record_AbstractRecord
) –