DBIx::Class::FormTools 0.000004
Sponsored Links
DBIx::Class::FormTools 0.000004 Ranking & Summary
File size:
0.009 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
1150
Date added:
2006-08-31
Publisher:
David Jack Olrik
DBIx::Class::FormTools 0.000004 description
DBIx::Class::FormTools is a utility module for building forms with multiple related DBIx::Class objects.
SYNOPSIS
In the examples I use 3 objects, a Film, an Actor and a Role. Role is a many to many relation between Film and Actor.
package MySchema;
use base DBIx::Class::Schema;
__PACKAGE__->load_classes(qw[
Film
Actor
Role
]);
package MySchema::Film;
__PACKAGE__->table(films);
__PACKAGE__->add_columns(qw[
id
title
]);
__PACKAGE__->set_primary_key(id);
__PACKAGE__->has_many(roles => MySchema::Role, film_id);
package MySchema::Actor;
__PACKAGE__->table(films);
__PACKAGE__->add_columns(qw[
id
name
]);
__PACKAGE__->set_primary_key(id);
__PACKAGE__->has_many(roles => MySchema::Role, actor_id);
package MySchema::Role;
__PACKAGE__->table(roles);
__PACKAGE__->add_columns(qw[
film_id
actor_id
]);
__PACKAGE__->set_primary_key(qw[
film_id
actor_id
]);
__PACKAGE__->belongs_to(film_id => MySchema::Film);
__PACKAGE__->belongs_to(actor_id => MySchema::Actor);
In your Model class
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/PK::Auto::Pg Core FormTools/);
In your view - HTML::Mason example
< %init >
my $film = $schema->resultset(Film)->find(42);
my $actor = $schema->resultset(Actor)->find(24);
< /%init >
< form >
< input
name="< % $film->form_fieldname(title, o1) => Title % >"
type="text"
value="< % $film->title % >"
/ >
< input
name="< % $film->form_fieldname(length, o1) % >"
type="text"
value="< % $film->length % >"
/ >
< input
name="< % $film->form_fieldname(comment, o1) % >"
type="text"
value="< % $film->comment % >"
/ >
< input
name="< % $actor->form_fieldname(name, o2) % >"
type="text"
value="< % $actor->name % >"
/ >
name="< % MyNamespace::Role->form_fieldname(undef, o3, {
film_id => o1,
actor_id => o2
}) %>"
type="hidden"
value="dummy"
/ >
/form>
In your controller (or cool helper module, used in your controller)
my @objects = DBIx::Class::FormTools->formdata_to_objects($querystring);
foreach my $object ( @objects ) {
# Assert and Manupulate $object as you like
$object->insert_or_update;
}
SYNOPSIS
In the examples I use 3 objects, a Film, an Actor and a Role. Role is a many to many relation between Film and Actor.
package MySchema;
use base DBIx::Class::Schema;
__PACKAGE__->load_classes(qw[
Film
Actor
Role
]);
package MySchema::Film;
__PACKAGE__->table(films);
__PACKAGE__->add_columns(qw[
id
title
]);
__PACKAGE__->set_primary_key(id);
__PACKAGE__->has_many(roles => MySchema::Role, film_id);
package MySchema::Actor;
__PACKAGE__->table(films);
__PACKAGE__->add_columns(qw[
id
name
]);
__PACKAGE__->set_primary_key(id);
__PACKAGE__->has_many(roles => MySchema::Role, actor_id);
package MySchema::Role;
__PACKAGE__->table(roles);
__PACKAGE__->add_columns(qw[
film_id
actor_id
]);
__PACKAGE__->set_primary_key(qw[
film_id
actor_id
]);
__PACKAGE__->belongs_to(film_id => MySchema::Film);
__PACKAGE__->belongs_to(actor_id => MySchema::Actor);
In your Model class
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/PK::Auto::Pg Core FormTools/);
In your view - HTML::Mason example
< %init >
my $film = $schema->resultset(Film)->find(42);
my $actor = $schema->resultset(Actor)->find(24);
< /%init >
< form >
< input
name="< % $film->form_fieldname(title, o1) => Title % >"
type="text"
value="< % $film->title % >"
/ >
< input
name="< % $film->form_fieldname(length, o1) % >"
type="text"
value="< % $film->length % >"
/ >
< input
name="< % $film->form_fieldname(comment, o1) % >"
type="text"
value="< % $film->comment % >"
/ >
< input
name="< % $actor->form_fieldname(name, o2) % >"
type="text"
value="< % $actor->name % >"
/ >
name="< % MyNamespace::Role->form_fieldname(undef, o3, {
film_id => o1,
actor_id => o2
}) %>"
type="hidden"
value="dummy"
/ >
/form>
In your controller (or cool helper module, used in your controller)
my @objects = DBIx::Class::FormTools->formdata_to_objects($querystring);
foreach my $object ( @objects ) {
# Assert and Manupulate $object as you like
$object->insert_or_update;
}
DBIx::Class::FormTools 0.000004 Screenshot
Advertisements
DBIx::Class::FormTools 0.000004 Keywords
DBIx
PACKAGE
FormTools
MySchema
FormTools 0.000004
for building
building forms
id
film
actor
objects
name
form
DBIx::Class::FormTools
DBIxClassFormTools
DBIx::Class::FormTools 0.000004
Bookmark DBIx::Class::FormTools 0.000004
DBIx::Class::FormTools 0.000004 Copyright
WareSeeker periodically updates pricing and software information of DBIx::Class::FormTools 0.000004 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of DBIx::Class::FormTools 0.000004 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
objects that reflect light
actor chris pine
package shark
karate kid actor
economic stimulus package 2008 tax rebates
form tools
myschema.exe
myspace falling objects
actor milo
objects in motion
packages from home
objects of my affection lyrics
filmi
actors
formtools.org
package tracking
actor wallach
package delivery
Related Software
Class::DBI::FormTools is a Perl module to build forms with multiple interconnected objects. Free Download
DBIx::Class::CDBICompat is a Class::DBI Compatibility layer. Free Download
DBIx::OO is a database to Perl objects abstraction. Free Download
DBIx::Class::LibXMLdoc is a Perl module to create an adjunct "Doc" accessor of a columns data. Free Download
DBIx:DataLookup 0.03 is designed as a useful tool which can help you easily both cache records pulled by an SQL statement from a database in the memory as well as look them up later at any time during execution of your script. Free Download
DBIx::SQLCrosstab::Format is a Perl module with formats results created by DBIx::SQLCrosstab. Free Download
DBIx::Password provides an abstraction layer for password maintenance. Free Download
DBIx::DataModel is a Perl module with Classes and UML-style Associations on top of DBI. Free Download
Latest Software
Popular Software
Favourite Software