CatalystX-CRUD-Model-RDBO

 view release on metacpan or  search on metacpan

lib/CatalystX/CRUD/Object/RDBO.pm  view on Meta::CPAN

 $foo->delete;

=head1 DESCRIPTION

CatalystX::CRUD::Object::RDBO implements the required CRUD methods
of a CatalystX::CRUD::Object subclass. It is intended for use
with CatalystX::CRUD::Model::RDBO.

=head1 METHODS

Only new or overridden methods are documented here.

=head2 load_speculative

Calls load( speculative => 1 ) on the internal delegate() value.

=cut

# convenience methods
sub load_speculative {
    shift->delegate->load( speculative => 1, @_ );
}

=head2 create

Calls delegate->save().

=cut

# required methods
sub create {
    shift->delegate->save(@_);
}

=head2 read

Calls delegate->load(). B<NOTE:> If you need a speculative load,
use load_speculative() instead.

=cut

sub read {

    # because of the abusive way RDBO handles load() internally,
    # must re-assign to delegate afterwards. This fixes esp the issue
    # of passing 'with' => 'rel' to load().

    my $cxcobj = shift;
    my $rdbo   = $cxcobj->delegate;
    $rdbo->load(@_);
    $cxcobj->{delegate} = $rdbo;
    return $cxcobj;
}

=head2 update

Calls delegate->save().

=cut

sub update {
    shift->delegate->save(@_);
}

=head2 delete

Calls delegate->delete(@_).

=cut

sub delete {
    shift->delegate->delete(@_);
}

=head2 is_new

Calls not_found() on the RDBO delegate.

=cut

sub is_new {
    shift->delegate->not_found();
}

=head2 serialize

Returns column/value pairs for RDBO delegate with all DateTime
et al objects serialized to strings.

=cut

sub serialize {
    return decode_json( column_values_as_json( shift->delegate ) );
}

1;

__END__

=head1 AUTHOR

Peter Karman, C<< <karman at cpan.org> >>

=head1 BUGS

Please report any bugs or feature requests to
C<bug-catalystx-crud-model-rdbo at rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CatalystX-CRUD-Model-RDBO>.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc CatalystX::CRUD::Model::RDBO

You can also look for information at:

=over 4



( run in 0.474 second using v1.01-cache-2.11-cpan-39bf76dae61 )