Constant to clarify behavior of second param to createRow().
Table data gateway for user password change tokens
$eav : \Dewdrop\Db\Eav\Definition
If this table has a corresponding set of EAV tables that can be used to define custom fields/attibutes for the model, this variable will be a reference to the EAV definition object.
$db : \Dewdrop\Db\Adapter
The database adapter used by this table
$activityLogHandler : \Dewdrop\ActivityLog\Handler\TableHandler
The activity log handler used to log events for this table.
$uniqueConstraints : array<mixed,\Dewdrop\Db\UniqueConstraint>
__construct(\Dewdrop\Db\Adapter $db = null)
Create new table object with supplied DB adapter
registerEav(array $options = array()) : \Dewdrop\Db\Table
Register an EAV definition with this table.
Additional options to pass to the EAV definition.
getEav() : \Dewdrop\Db\Eav\Definition
Get the EAV definition associated with this table.
getUniqueConstraintsAffectingColumn(string $columnName) : array<mixed,\Dewdrop\Db\UniqueConstraint>
hasMany(string $relationshipName, string $xrefTableName, array $additionalOptions = array())
Register a many-to-many relationship with this table. This will allow you to retrieve and set the values for this relationship from row objects and also generate field objects representing this relationship.
Generally, supplying the relationship name and the cross-reference table name are all you need to do to register the relationship. However, if Dewdrop cannot determine the additional pieces of information needed to support the relationship, you can specify those manually using the additional options array.
Once registered, you can use the relationship name you supplied as if it was a normal field. So, you can do things like:
$this->insert( array( 'name' => 'Concrete DB column value', 'foo_id' => 2, 'my_relationship_name' => array(1, 2, 3) ) );
In the latter example, Dewdrop will automatically save the cross-reference table values following the primary INSERT query.
getManyToManyRelationship(string $name) : \Dewdrop\Db\ManyToMany\Relationship
Retrieve the many-to-many relationship with the given name. You should call hasManyToManyRelationship() prior to this to ensure the relationship exists.
getRowColumns() : array
Get an array representing the valid column names that can be get or set on a row object tied to this table. This will include the concrete columns present in the physical database table and the many-to-many or EAV fields registered with and managed by this table object.
field(string $name) : \Dewdrop\Db\Field
Retrieve the field object associated with the specified name.
customizeField(string $name, mixed $callback) : \Dewdrop\Db\Table
Assign a callback that will allow you to further customize a field object whenever that object is requested using the table's field() method.
setRowClass(string $rowClass) : \Dewdrop\Db\Table
Allow setting of custom row class for this table.
setSingularTitle(string $singularTitle) : \Dewdrop\Db\Table
Override the default singular title.
setPluralTitle(string $pluralTitle) : \Dewdrop\Db\Table
Manually override the inflected plural title for this model.
getMetadata(string $section = null, string $index = null) : array
Load this table's metadata from the file generated by the db-metadata CLI command. The metadata currently has two sections:
You can retrieve the entirety of the metadata information by providing null values to both arguments. You can retrieve an entire section of the metdata by only specifying the first argument. Or, you can specify values for both arguments to retrieve a specific member of a specific section.
For example, to get metadata only for the "name" column, you would call:
getAdapter() : \Dewdrop\Db\Adapter
Get the DB adapter associated with this table object.
select() : \Dewdrop\Db\Select
Create a new \Dewdrop\Db\Select object.
selectListing() : \Dewdrop\Db\Select
Generate a listing Select object. A listing attempts to include values for foreign keys, many-to-many relationships for contexts such as admin CRUD components where you intend to display all the information related to a certain set of entities.
selectAdminListing() : \Dewdrop\Db\Select
By default, returns the same value as selectListing(). However, this is here as a placeholder for any admin-area specific listing changes you need to make for this model.
insert(array $data) : integer|null
Insert a new row.
Data should be supplied as key value pairs, with the keys representing the column names.
We return the ID of the inserted row because if we do not return it from insert(), it will be impossible to retrieve it, if we have many-to-many or EAV fields that also inserted rows before this method returns.
Last insert ID, if the table has auto-incrementing key.
update(array $data, string $where) : integer
Update an existing row.
Data should be supplied as key value pairs, with the keys representing the column names. The where clause should be an already assembled and quoted string. It should not be prefixed with the "WHERE" keyword.
The number of rows affected.
find() : \Dewdrop\Db\Row|null
Find a single row based upon primary key value.
createRow(array $data = array(), boolean $shareFieldObjectsWithRow = self::SHARE_FIELD_OBJECTS_WITH_ROW) : \Dewdrop\Db\Row
Create a new row object, assigning the provided data as its initial state.
By default, rows share the same field objects that were instantiated on the table itself. This makes it easy to customize fields prior to the row being available. However, in some rare cases, you want to edit multiple rows created from the same model instance. To do so, you'll need new field objects per-row. To achieve this separation, you can call this method with Table::NEW_FIELD_OBJECTS_PER_ROW as the second parameter.
augmentInsertedDataArrayWithWhenAndByWhom(array $data) : array
If this table has date_created or datetime_created columns, supply a value for them automatically during insert(). It also will assign the current user ID as the creator if possible.
augmentUpdatedDataArrayWithWhenAndByWhom(array $data) : array
If this table has date_updated or datetime_updated columns, supply a value for them automatically during update(). It also will assign the current user ID as the updater if possible.
filterDataArrayForPhysicalColumns(array $data) : array
Filter the data array that was passed to either insert() or update() so that it only has keys that match physical database columns, not many-to-many relationships managed by this table.
The filtered version of the data array.
saveManyToManyRelationships(array $data, integer $pkeyValue = null) : \Dewdrop\Db\Table
Save any many-to-many relationship values that were passed to insert() or update().
saveEav(array $data, integer $pkeyValue = null) : \Dewdrop\Db\Table
Save any EAV attributes matching keys in the supplied data array. We can only save EAV attributes, if there is a primary key value available, either via the $data array itself or the lastInsertId().