[Dbix-class] Can't get last insert id ?!
Pedro Melo
melo at simplicidade.org
Fri Nov 10 22:51:06 GMT 2006
Hi,
On Nov 10, 2006, at 7:25 PM, Ivan.Georgiev at uboc.com wrote:
> PS.
> One thing may be not so important... is it possible so that we have
> a alias
> to ->resultset() it is too long, especialy when u chain
> several calls it eats up all the space ;)) ....... i.e. ->rs()
> As we talk about aliases, what about ;) :
> $schema->from($table)->select(\%where);
This was discussed last week or the previous one.
I use this:
use strict;
use base qw/DBIx::Class::Schema/;
foreach my $class (qw/TableOne TableTwo TableThree/) {
__PACKAGE__->load_classes($class);
my $method = $class;
$method =~ s/([a-z])([A-Z])/${1}_$2/g;
$method = lc($method);
no strict 'refs';
*{__PACKAGE__ . "::$method"}
= sub { return shift->resultset($class) };
}
1;
This allows you to use:
$schema->table_one->seach...
Best regards,
--
Pedro Melo
JID: xmpp:melo at simplicidade.org
More information about the Dbix-class
mailing list