X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRow.pm;h=bf2c408147b5f3e23b7675d6191e5584d3cf4b0e;hb=7e38d85069fbeeff050dc736b756b60c01f85fc6;hp=eab11d9aa3081fde84fbede8291650c5cca7ef68;hpb=b9b4e52f923e01eb496eb04a70e82824ecbe9dbe;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index eab11d9..bf2c408 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -451,6 +451,20 @@ sub get_dirty_columns { keys %{$self->{_dirty_columns}}; } +=head2 make_column_dirty + +Marks a column dirty regardless if it has really changed. Throws an +exception if the column does not exist. + +=cut +sub make_column_dirty { + my ($self, $column) = @_; + + $self->throw_exception( "No such column '${column}'" ) + unless exists $self->{_column_data}{$column} || $self->has_column($column); + $self->{_dirty_columns}{$column} = 1; +} + =head2 get_inflated_columns my %inflated_data = $obj->get_inflated_columns; @@ -785,20 +799,28 @@ sub register_column { $class->mk_group_accessors('column' => $acc); } -=head2 get_current_storage +=head2 get_from_storage ($attrs) Returns a new Row which is whatever the Storage has for the currently created -Row object. You ca use this to see if the storage has become inconsistent with +Row object. You can use this to see if the storage has become inconsistent with whatever your Row object is. +$attrs is expected to be a hashref of attributes suitable for passing as the +second argument to $resultset->search($cond, $attrs); + =cut -sub get_current_storage { +sub get_from_storage { my $self = shift @_; + my $attrs = shift @_; my @primary_columns = map { $self->$_ } $self->primary_columns; - return $self->result_source->schema->txn_do(sub { - return $self->result_source->resultset->find(@primary_columns); - }); + my $resultset = $self->result_source->resultset; + + if(defined $attrs) { + $resultset = $resultset->search(undef, $attrs); + } + + return $resultset->find(@primary_columns); } =head2 throw_exception