On Wed, Mar 24, 2010 at 7:53 AM, fREW Schmidt <fri...@gmail.com> wrote:
> I'll only answer your last issue, since it doesn't make any sense at all in > DBIC context: > > ... > __PACKAGE__->set_primary_key(qw( part_id customer_id )); > ... > > The above class has a MultiPK. In general I don't like MultiPK but the > fact that DBIC supports it allows us to actually use our customer's > database. If we were to stringify this object how could that work? Do we > do "$part_id,$customer_id"? > We have tables with multiple primary keys, but I can't think of a case where we have used them in this way -- mostly it's $cd->artist where it's a single key. That said, stringification can be overridden, of course, to produce any format you wish. > *But* because DBIC is written in such a manner that everything is > extensible you could add this feature in. I could probably make a component > to stringify my objects to their pk in about half an hour. I won't do it > because I think that's just a silly thing to do; but you can, and that's the > whole point. > I wasn't saying it was hard to stringify DBIC objects, just more remarking what a useful feature it had been with Class::DBI. It seems silly if it's not what you are used to. But, it turns out that it makes a bunch of code very simple since you can often work abstract objects. $telephone_connection->dial( $user->phone ) is a nice abstraction (even if not the best example). -- Bill Moseley mose...@hank.org
_______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk