SHARE_FIELD_OBJECTS_WITH_ROW
SHARE_FIELD_OBJECTS_WITH_ROW
Constant to clarify behavior of second param to createRow().
Users database table class
$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>
loadUserByUsername(string $username) : \Dewdrop\Auth\Db\UserRowGateway
Loads the user for the given username.
This method must throw UsernameNotFoundException if the user is not found.
string | $username | The username |
if the user is not found
loadUserByEmailAddress(string $emailAddress) : \Dewdrop\Auth\Db\UserRowGateway|null
Returns the user for the given email address or null on failure
string | $emailAddress |
refreshUser(\Symfony\Component\Security\Core\User\UserInterface $user) : \Symfony\Component\Security\Core\User\UserInterface
Refreshes the user for the account interface.
It is up to the implementation to decide if the user data should be totally reloaded (e.g. from the database), or if the UserInterface object can just be merged into some internal array of users / identity map.
\Symfony\Component\Security\Core\User\UserInterface | $user |
if the account is not supported
selectAdminListing() : \Dewdrop\Db\Select
Returns a select object for the admin listing
__construct(\Dewdrop\Db\Adapter $db = null)
Create new table object with supplied DB adapter
\Dewdrop\Db\Adapter | $db |
setActivityLogHandler(\Dewdrop\ActivityLog\Handler\HandlerInterface $activityLogHandler)
\Dewdrop\ActivityLog\Handler\HandlerInterface | $activityLogHandler |
registerEav(array $options = array()) : \Dewdrop\Db\Table
Register an EAV definition with this table.
array | $options | 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>
string | $columnName |
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:
$row->field('my_relationship_name');
Or:
$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.
string | $relationshipName | |
string | $xrefTableName | |
array | $additionalOptions |
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.
string | $name |
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.
string | $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.
string | $name | |
mixed | $callback |
setRowClass(string $rowClass) : \Dewdrop\Db\Table
Allow setting of custom row class for this table.
string | $rowClass |
setSingularTitle(string $singularTitle) : \Dewdrop\Db\Table
Override the default singular title.
string | $singularTitle |
setPluralTitle(string $pluralTitle) : \Dewdrop\Db\Table
Manually override the inflected plural title for this model.
string | $pluralTitle |
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:
$this->getMetadata('columns', 'name');
string | $section | |
string | $index |
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.
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.
array | $data |
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.
array | $data | |
string | $where |
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.
array | $data | |
boolean | $shareFieldObjectsWithRow |
fetchRow(string|\Dewdrop\Db\Select $sql, array $bind = array()) : null|\Dewdrop\Db\Row
Fetch a single row by running the provided SQL. If no matching row is found, null will be returned.
string|\Dewdrop\Db\Select | $sql | |
array | $bind |
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.
array | $data |
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.
array | $data |
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.
array | $data |
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().
array | $data | |
integer | $pkeyValue |
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().
array | $data | |
integer | $pkeyValue |