CompositeDBField
interface CompositeDBField
Apply this interface to any {@link DBField} that doesn't have a 1-1 mapping with a database field.
This includes multi-value fields and transformed fields
Methods
Set the value of this field in various formats.
Add the custom internal values to an INSERT or UPDATE request passed through the ORM with {@link DataObject->write()}.
Add all columns which are defined through {@link requireField()} and {@link $composite_db}, or any additional SQL that is required to get to these columns. Will mostly just write to the {@link SQLQuery->select} array.
Return array in the format of {@link $composite_db}.
Determines if the field has been changed since its initialization.
Determines if any of the properties in this field have a value, meaning at least one of them is not NULL.
Details
at line 126
setValue(DBField|array $value, DataObject|array $record = null, boolean $markChanged = true)
Set the value of this field in various formats.
Used by {@link DataObject->getField()}, {@link DataObject->setCastedField()} {@link DataObject->dbObject()} and {@link DataObject->write()}.
As this method is used both for initializing the field after construction, and actually changing its values, it needs a {@link $markChanged} parameter.
at line 148
writeToManipulation(array $manipulation)
Add the custom internal values to an INSERT or UPDATE request passed through the ORM with {@link DataObject->write()}.
Fields are added in $manipulation['fields']. Please ensure these fields are escaped for database insertion, as no further processing happens before running the query. Use {@link DBField->prepValueForDB()}. Ensure to write NULL or empty values as well to allow unsetting a previously set field. Use {@link DBField->nullValue()} for the appropriate type.
at line 158
addToQuery(SQLQuery $query)
Add all columns which are defined through {@link requireField()} and {@link $composite_db}, or any additional SQL that is required to get to these columns. Will mostly just write to the {@link SQLQuery->select} array.
at line 165
array
compositeDatabaseFields()
Return array in the format of {@link $composite_db}.
Used by {@link DataObject->hasOwnDatabaseField()}.
at line 174
boolean
isChanged()
Determines if the field has been changed since its initialization.
Most likely relies on an internal flag thats changed when calling {@link setValue()} or any other custom setters on the object.
at line 182
boolean
exists()
Determines if any of the properties in this field have a value, meaning at least one of them is not NULL.