interface DataObjectInterface

DataObjectInterface is an interface that other data systems in your application can implement in order to behave in a manner similar to DataObject.

In addition to the methods defined below, the data of the object should be directly accessible as fields.

Methods

__construct()

Create a new data object, not yet in the database. To load an object into the database, a null object should be constructed, its fields set, and the write() method called.

write()

Write the current object back to the database. It should know whether this is a new object, in which case this would be an insert command, or if this is an existing object queried from the database, in which case thes would be

delete()

Remove this object from the database. Doesn't do anything if this object isn't in the database.

mixed
__get(string $fieldName)

Get the named field.

$this
setCastedField(string $fieldName, mixed $val)

Save content from a form into a field on this data object.

Details

at line 17
__construct()

Create a new data object, not yet in the database. To load an object into the database, a null object should be constructed, its fields set, and the write() method called.

at line 24
write()

Write the current object back to the database. It should know whether this is a new object, in which case this would be an insert command, or if this is an existing object queried from the database, in which case thes would be

at line 29
delete()

Remove this object from the database. Doesn't do anything if this object isn't in the database.

at line 39
mixed __get(string $fieldName)

Get the named field.

This function is sometimes called explicitly by the form system, so you need to define it, even if you use the default field system.

Parameters

string $fieldName

Return Value

mixed

at line 49
$this setCastedField(string $fieldName, mixed $val)

Save content from a form into a field on this data object.

Since the data comes straight from a form it can't be trusted and will need to be validated / escaped.'

Parameters

string $fieldName
mixed $val

Return Value

$this