Updated version and Changes for 0.06999_02
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / InflateColumn.pm
index 013c724..3cea9bb 100644 (file)
@@ -50,6 +50,11 @@ corresponding table class using something like:
 (Replace L<DateTime::Format::Pg> with the appropriate module for your
 database, or consider L<DateTime::Format::DBI>.)
 
+The coderefs you set for inflate and deflate are called with two parameters,
+the first is the value of the column to be inflated/deflated, the second is the
+row object itself. Thus you can call C<< ->result_source->schema->storage->dbh >> on
+it, to feed to L<DateTime::Format::DBI>.
+
 In this example, calls to an event's C<insert_time> accessor return a
 L<DateTime> object. This L<DateTime> object is later "deflated" when
 used in the database layer.
@@ -89,6 +94,17 @@ sub _deflated_column {
   return $deflate->($value, $self);
 }
 
+=head2 get_inflated_column
+
+  my $val = $obj->get_inflated_column($col);
+
+Fetch a column value in its inflated state.  This is directly
+analogous to L<DBIx::Class::Row/get_column> in that it only fetches a
+column already retreived from the database, and then inflates it.
+Throws an exception if the column requested is not an inflated column.
+
+=cut
+
 sub get_inflated_column {
   my ($self, $col) = @_;
   $self->throw_exception("$col is not an inflated column")
@@ -100,12 +116,31 @@ sub get_inflated_column {
            $self->_inflated_column($col, $self->get_column($col));
 }
 
+=head2 set_inflated_column
+
+  my $copy = $obj->set_inflated_column($col => $val);
+
+Sets a column value from an inflated value.  This is directly
+analogous to L<DBIx::Class::Row/set_column>.
+
+=cut
+
 sub set_inflated_column {
   my ($self, $col, @rest) = @_;
   my $ret = $self->_inflated_column_op('set', $col, @rest);
   return $ret;
 }
 
+=head2 store_inflated_column
+
+  my $copy = $obj->store_inflated_column($col => $val);
+
+Sets a column value from an inflated value without marking the column
+as dirty.  This is directly analogous to
+L<DBIx::Class::Row/store_column>.
+
+=cut
+
 sub store_inflated_column {
   my ($self, $col, @rest) = @_;
   my $ret = $self->_inflated_column_op('store', $col, @rest);
@@ -128,6 +163,13 @@ sub _inflated_column_op {
   return $obj;
 }
 
+=head2 update
+
+Updates a row in the same way as L<DBIx::Class::Row/update>, handling
+inflation and deflation of columns appropriately.
+
+=cut
+
 sub update {
   my ($class, $attrs, @rest) = @_;
   $attrs ||= {};
@@ -141,6 +183,13 @@ sub update {
   return $class->next::method($attrs, @rest);
 }
 
+=head2 new
+
+Creates a row in the same way as L<DBIx::Class::Row/new>, handling
+inflation and deflation of columns appropriately.
+
+=cut
+
 sub new {
   my ($class, $attrs, @rest) = @_;
   $attrs ||= {};