| Catalyst-Model-CDBI-CRUD documentation | Contained in the Catalyst-Model-CDBI-CRUD distribution. |
Catalyst::Model::CDBI::CRUD - CRUD CDBI Model Class
# lib/MyApp/Model/CDBI.pm
package MyApp::Model::CDBI;
use base 'Catalyst::Model::CDBI::CRUD';
__PACKAGE__->config(
dsn => 'dbi:SQLite2:/tmp/myapp.db',
relationships => 1
);
1;
# lib/MyApp.pm
package MyApp;
use Catalyst 'FormValidator';
__PACKAGE__->config(
name => 'My Application',
root => '/home/joeuser/myapp/root'
);
sub table : Global {
my ( $self, $c ) = @_;
$c->form( optional => [ MyApp::Model::CDBI::Table->columns
] ); #see Data::FormValidator
$c->forward('MyApp::Model::CDBI::Table');
}
sub end : Private {
$c->forward('MyApp::V::TT');
}
1;
This is a subclass of Catalyst::Model::CDBI with additional CRUD
methods. Don't forget to copy the base templates to config->root!
*NOTE* This module has been deprecated. See BUGS section below!
Does nothing by default.
Deletes a Class::DBI object.
Creates a new Class::DBI object from $c->form.
Updates a Class::DBI object from $c->form.
Does nothing by default.
Does nothing by default.
Dispatches CRUD request to methods.
Does nothing by default.
This module is no longer supported by the Catalyst developers. We keep it indexed for the sake of existing users, but highly recommend new users to look at Catalyst::Helper::Controller::Scaffold
Sebastian Riedel, sri@cpan.org
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
| Catalyst-Model-CDBI-CRUD documentation | Contained in the Catalyst-Model-CDBI-CRUD distribution. |
package Catalyst::Model::CDBI::CRUD; use strict; use base 'Catalyst::Model::CDBI'; use Class::DBI::AsForm; use Class::DBI::FromForm; use Class::DBI::Plugin::RetrieveAll; our $VERSION = '0.04';
sub add { }
sub destroy { my ( $self, $c ) = @_; $c->stash->{item}->delete; $c->stash->{template} = 'list'; }
sub do_add { my ( $self, $c ) = @_; $self->create_from_form( $c->form ); $c->stash->{template} = 'list'; }
sub do_edit { my ( $self, $c ) = @_; $c->stash->{item}->update_from_form( $c->form ); $c->stash->{template} = 'edit'; }
sub edit { }
sub list { }
sub process { my $self = shift; my $c = shift; my $method = shift || 'list'; $c->stash->{item} = $self->retrieve( $_[0] ) if defined( $_[0] ); $c->stash->{template} = $method; $c->stash->{class} = ref $self || $self; $self->$method( $c, @_ ) if $self->can($method); }
sub view { }
1;