Interface CompositeDBField
Apply this interface to any DBField that doesn't have a 1-1 mapping
with a database field. This includes multi-value fields and transformed
fields
Direct known implementers
Money
Methods summary
public
|
#
setValue( DBField|array $value, array $record = null, boolean $markChanged = true )
Set the value of this field in various formats. Used by DataObject->getField(), DataObject->setCastedField() DataObject->dbObject() and DataObject->write().
Set the value of this field in various formats. Used by DataObject->getField(), DataObject->setCastedField() DataObject->dbObject() and DataObject->write().
As this method is used both for initializing the field after construction,
and actually changing its values, it needs a $markChanged parameter.
Parameters
- $value
- DBField|array $value
- $record
- array $record Map of values loaded from the database
- $markChanged
- boolean $markChanged Indicate wether this field should be marked changed. Set to
FALSE if you are initializing this field after construction, rather than setting
a new value.
|
public
|
#
writeToManipulation( array & $manipulation )
Add the custom internal values to an INSERT or UPDATE request passed through
the ORM with 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 DBField->prepValueForDB(). Ensure to write NULL or empty values as well to
allow unsetting a previously set field. Use DBField->nullValue() for
the appropriate type.
Add the custom internal values to an INSERT or UPDATE request passed through
the ORM with 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 DBField->prepValueForDB(). Ensure to write NULL or empty values as well to
allow unsetting a previously set field. Use DBField->nullValue() for
the appropriate type.
Parameters
- $manipulation
- array $manipulation
|
public
|
#
addToQuery( SQLQuery & $query )
Add all columns which are defined through requireField() and $composite_db, or any additional SQL that is required to get to these columns.
Will mostly just write to the SQLQuery->select array.
Add all columns which are defined through requireField() and $composite_db, or any additional SQL that is required to get to these columns.
Will mostly just write to the SQLQuery->select array.
Parameters
|
public
array
|
#
compositeDatabaseFields( )
Return array in the format of $composite_db. Used by DataObject->hasOwnDatabaseField().
Return array in the format of $composite_db. Used by DataObject->hasOwnDatabaseField().
Returns
array array
Used by
|
public
boolean
|
#
isChanged( )
Determines if the field has been changed since its initialization. Most
likely relies on an internal flag thats changed when calling CompositeDBField::setValue()
or any other custom setters on the object.
Determines if the field has been changed since its initialization. Most
likely relies on an internal flag thats changed when calling CompositeDBField::setValue()
or any other custom setters on the object.
Returns
boolean boolean
|
public
boolean
|
#
hasValue( )
Determines if any of the properties in this field have a value, meaning at
least one of them is not NULL.
Determines if any of the properties in this field have a value, meaning at
least one of them is not NULL.
Returns
boolean boolean
|
Magic methods summary
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the
Silverstripe Forums to ask development related questions.
-