Record
class Record extends Entity (View source)
Class Record
Constants
DUMP_ALL_DATA |
|
UPDATE_NULLS |
|
LOAD_DEFAULT |
|
Methods
Object constructor to set table and key fields. In most cases this will be overridden by child classes to explicitly set the table and key fields for a particular database table.
Method to bind an associative array or object to the AbstractTable instance. This method only binds properties that are publicly accessible and optionally takes an array of properties to ignore when binding.
Apply a user supplied function to every member of this object.
Method to reset class properties to the defaults set in the class definition. It will ignore the primary key as well as any private class properties.
Method to provide a shortcut to binding, checking and storing a AbstractTable instance to the database table. The method will check a row in once the data has been stored and if an ordering filter is present will attempt to reorder the table rows based on the filter. The ordering filter is an instance property name. The rows that will be reordered are those whose value matches the AbstractTable instance for the property specified.
Method to load a row from the database by primary key and bind the fields to the AbstractTable instance properties.
Method to delete a row from the database table by primary key value.
Method to perform sanity checks on the AbstractTable instance properties to ensure they are safe to store in the database. Child classes should override this method to make sure the data they are storing in the database is safe and as expected before storage.
Method to store a row in the database from the AbstractTable instance properties.
Get the table name.
Method to set property table
Method to get the primary key field name for the table.
Validate that the primary key has been set.
Check a field value exists in database or not, to keep a field unique.
Method to get property Dispatcher
loadDefault
Method to get property Mapper
Details
at line line 118
__construct(string $table = null, mixed $keys = 'id', AbstractDataMapper $mapper = null)
Object constructor to set table and key fields. In most cases this will be overridden by child classes to explicitly set the table and key fields for a particular database table.
at line line 185
Data
bind(mixed $src, boolean $replaceNulls = false)
Method to bind an associative array or object to the AbstractTable instance. This method only binds properties that are publicly accessible and optionally takes an array of properties to ignore when binding.
Data
set(string $key, mixed $value = null)
Magic setter to set a table field.
mixed
get(string $key, mixed $default = null)
Magic getter to get a table field.
Traversable
getIterator(bool $all = false)
Get an iterator object.
Data
walk(callable $callback, mixed $userdata = null)
Apply a user supplied function to every member of this object.
at line line 680
Entity
reset(bool $loadDefault = true)
Method to reset class properties to the defaults set in the class definition. It will ignore the primary key as well as any private class properties.
at line line 162
$this
save(mixed $src, boolean $updateNulls = false)
Method to provide a shortcut to binding, checking and storing a AbstractTable instance to the database table. The method will check a row in once the data has been stored and if an ordering filter is present will attempt to reorder the table rows based on the filter. The ordering filter is an instance property name. The rows that will be reordered are those whose value matches the AbstractTable instance for the property specified.
at line line 248
Record
load(mixed $keys = null, boolean $reset = true)
Method to load a row from the database by primary key and bind the fields to the AbstractTable instance properties.
at line line 310
Record
delete(mixed $conditions = null)
Method to delete a row from the database table by primary key value.
at line line 350
Record
validate()
Method to perform sanity checks on the AbstractTable instance properties to ensure they are safe to store in the database. Child classes should override this method to make sure the data they are storing in the database is safe and as expected before storage.
at line line 368
Record
store(boolean $updateNulls = false)
Method to store a row in the database from the AbstractTable instance properties.
If a primary key value is set the row with that primary key value will be updated with the instance property values. If no primary key value is set a new row will be inserted into the database with the properties from the AbstractTable instance.
at line line 460
string
getTableName()
Get the table name.
at line line 513
array|mixed
getKeyName(boolean $multiple = false)
Method to get the primary key field name for the table.
at line line 532
boolean
hasPrimaryKey()
Validate that the primary key has been set.
at line line 565
bool
valueExists(string $field, null $value = null)
Check a field value exists in database or not, to keep a field unique.
at line line 638
DispatcherInterface
getDispatcher()
Method to get property Dispatcher
at line line 662
Record
setDispatcher(DispatcherInterface $dispatcher)
Method to set property dispatcher
at line line 718
AbstractDataMapper
getDataMapper()
Method to get property Mapper
at line line 735
Record
setDataMapper(AbstractDataMapper $mapper)
Method to set property mapper