Carl Franks([EMAIL PROTECTED])@Wed, Jan 23, 2008 at 10:17:55AM +0000: > On 21/01/2008, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Carl Franks([EMAIL PROTECTED])@Mon, Jan 21, 2008 at 07:15:48PM +0000: > > > On 21/01/2008, Вячеслав Тихановский <[EMAIL PROTECTED]> wrote: > > > > Hello. > > > > > > > > Probably I found a bug. > > > > > > > > If I have relationships like this: > > > > > > > > Bands (bandid, name) > > > > -> has_many map_band_user > > > > -> many_to_many genres > > > > > > > > Genres (genreid, name) > > > > -> has_many map_band_user > > > > -> many_to_many bands > > > > > > > > BandGenre(bandid, genreid) > > > > -> belongs to band > > > > -> belongs to genre > > > > > > > > To check genres I use the following config: > > > > > > > > - type: Select > > > > name: genres > > > > label: Genres > > > > multiple: 1 > > > > db: > > > > default_column: genreid > > > > > > > > Of course then defaults_from_model fires up with: > > > > > > > > DBI Exception: DBD::mysql::st execute failed: Column 'genreid' in > > > > field list is ambiguous [for Statement "SELECT genreid FROM > > > > bands_band_genre me JOIN bands_genres genre ON ( genre.genreid = > > > > me.genreid ) WHERE ( me.bandid = ? )" with ParamValues: 0='1'] at > > > > /usr/lib/perl5/vendor_perl/5.8.8/DBIx/Class/Schema.pm line 945 > > > > > > I think this may be down to the relationship declaration in your dbic > > > schema. > > > Because you have 2 tables with the same column name, do you need to > > > provide a join condition, rather than just a column name to your > > > many_to_many() declaration? > > > > > > Carl > > > > There are no problems in using my schema all over my app, I always use the > > same > > names just not to get confused, and always use 'me.' aliasing if they are > > ambiguous. The problem is that HTML::FormFu::Model::DBIC doesn't count on > > that. > > Okay, I've applied your patch - though I've changed it to: > unless $pk =~ /\./; > instead of: > unless $pk =~ /^me\./; > for a little more flexibility. Do you foresee any problems with that? > > Cheers, > Carl
Cool. I think that would work like "Don't make any aliasing if we found one". Just what is needed I guess. Thanks! -- vti -- Viacheslav Tikhanovskii _______________________________________________ HTML-FormFu mailing list [email protected] http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
