NAME
DBIx::QuickORM::Join::Row - A row representing a fetched join result.
DESCRIPTION
A row (see DBIx::QuickORM::Role::Row) produced by fetching from a DBIx::QuickORM::Join. The flat join result is fractured into one underlying row per joined component; this object holds those sub-rows and delegates field and state queries to them, prefixing field names with their component alias (alias.field).
Field-level reads and bulk state queries (in storage, desynced, etc.) work across all sub-rows. Manipulation and link-traversal methods are not implemented for join rows and croak if called.
SYNOPSIS
my $row = $connection->manager->select(source => $join, fetched => \%data);
my $sub = $row->by_alias('b');
my @subs = $row->by_source('users');
my $value = $row->field('b.name');
ATTRIBUTES
- source
-
Coderef returning the join source this row came from.
- connection
-
Coderef returning the owning connection.
- by_alias
-
Hashref mapping each component alias to its sub-row.
- by_source
-
Hashref mapping each source name to an arrayref of its sub-rows.
PUBLIC METHODS
- $join = $row->source
-
The join source this row came from.
- $con = $row->connection
-
The owning connection.
- $row->row_data
-
Not implemented for join rows; croaks. A join row has no single row-data object of its own.
- $sub = $row->by_alias($alias)
-
Return the sub-row for the given component alias. Croaks for an unknown alias.
- @subs = $row->by_source($name)
-
Return the sub-rows belonging to the named source. Croaks for an unknown source.
PRIVATE METHODS
- @out = $row->_row_map(\&cb)
-
Invoke the callback for each alias/sub-row pair (via
$a/$b) and return the flattened results. - $bool = $row->_row_any(\&cb)
-
True if the callback returns true for any sub-row.
- $bool = $row->_row_all(\&cb)
-
True if the callback returns true for every sub-row.
PUBLIC METHODS (state)
- $data = $row->stored_data
- $data = $row->pending_data
- $data = $row->desynced_data
-
Merge the corresponding data from every sub-row into a single hashref keyed by
alias.field. - $bool = $row->is_desynced
- $bool = $row->has_pending
- $bool = $row->in_storage
- $bool = $row->is_stored
- $bool = $row->is_invalid
- $bool = $row->is_valid
-
True if the corresponding condition holds for any sub-row.
PUBLIC METHODS (sanity checks)
PUBLIC METHODS (manipulation)
- $row->update
- $row->insert
- $row->insert_or_save
-
Not implemented for join rows; these croak.
- $row = $row->force_sync
- $row = $row->discard
- $row = $row->refresh
- $row = $row->save
- $row = $row->delete
-
Apply the operation to every sub-row and return self.
PUBLIC METHODS (fields)
- $value = $row->field($proto, ...)
- $value = $row->raw_field($proto, ...)
- $value = $row->stored_field($proto, ...)
- $value = $row->pending_field($proto, ...)
- $value = $row->raw_stored_field($proto, ...)
- $value = $row->raw_pending_field($proto, ...)
- $bool = $row->field_is_desynced($proto, ...)
-
Delegate to the sub-row named by the
alias.fieldproto, calling the matching single-field accessor on it. - $data = $row->fields(@protos)
- $data = $row->raw_fields(@protos)
- $data = $row->stored_fields(@protos)
- $data = $row->pending_fields(@protos)
- $data = $row->raw_stored_fields(@protos)
- $data = $row->raw_pending_fields(@protos)
-
Return a hashref of the requested
alias.fieldprotos to their values, pulled from the relevant sub-rows.
PUBLIC METHODS (links)
- $row->siblings
- $row->follow
- $row->obtain
-
Link traversal is not implemented for join rows; these croak.
SOURCE
The source code repository for DBIx::QuickORM can be found at https://github.com/exodist/DBIx-QuickORM.
MAINTAINERS
AUTHORS
COPYRIGHT
Copyright Chad Granum <exodist7@gmail.com>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.