Re: [CDBI] State of the DBIx::Class Class::DBI compatibility layer
"Rod McChesney" <[email protected]> Wed, 13 Feb 2008 20:45:59 -0800
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi,gmane.comp.lang.perl.modules.dbix-class |
|---|---|
| Message-ID | <[email protected]> |
> with the important caveat that relationships (has_a, has_many...) have to be > declared *after* all classes have been declared. Could you expand on that a little? Not sure exactly what it means. Does it means that you can't define the relationships with the class, but have to run the has_* statements after all the relevant classes have been use'd somewhere? Seems like that would be a Bad Thing... Thx, Rod On Feb 13, 2008 4:31 PM, Michael G Schwern <[email protected]> wrote: > DBIx::Class::CDBICompat is in fantastic shape for anyone curious about > transitioning from Class::DBI to DBIx::Class. It's down to really > niggling, > undocumented details, like the exact particulars of when lazy loading > happens. > > The improved DBIx::Class::CDBICompat is not available on CPAN but only > from > its own branch. It keeps up to date with trunk changes. Eventually it > will > merge into trunk once I get the attention of a DBIC person for a couple > hours. > > http://dev.catalyst.perl.org/repos/bast/DBIx-Class/0.08/branches/cdbicompat_integration > > > The critical thing to realize is that this is *not* a subclass or wrapper > around DBIx::Class but a series of plugins. When you use CDBICompat you > get > DBIx::Class objects and all of DBIx::Class' features are available. This > allows one to ease into the new features offered by DBIx::Class without > having > to rewrite your whole code base. One of the first things you'll want to > look > at is DBIx::Class::ResultSet for all it's advanced search() features. > > The CDBICompat documentation has been improved a bit to make it clearer > how to > use it and what the limitations are. You should be able to just change > > use base qw(Class::DBI); > > with > > use base qw(DBIx::Class::CDBICompat); > > with the important caveat that relationships (has_a, has_many...) have to > be > declared *after* all classes have been declared. > > > Bonus features: > > $obj->{column} now works. I didn't want to emulate that hack, but the > folks > who are paying me to do this needed it. Ironically, because it goes > through a > tied scalar, it will be slower than $obj->column(). > > nocache() of Class::DBI::Plugin::NoCache is emulated so you can turn the > object cache off. > > search_where() of Class::DBI::AbstractSearch is emulated, though there's > not > much point because DBIC's search is almost exactly the same and better. > > _______________________________________________ ClassDBI mailing list ClassDBI-Ra3b/[email protected] http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi