[html-formfu] many_to_many save_to_model & defaults_from_model

Carl Franks fireartist at gmail.com
Mon Jan 21 19:15:48 GMT 2008


On 21/01/2008, Вячеслав Тихановский <viacheslav.t at gmail.com> 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


More information about the HTML-FormFu mailing list