[html-formfu] many_to_many populates correctly, but throws
exception on update
Hailin Hu
i at h2l.name
Sun Sep 9 16:31:43 GMT 2012
Does this help?
http://search.cpan.org/~rudy/DBD-Pg-1.31/Pg.pm#Schema_support
On Fri, Aug 24, 2012 at 12:09 AM, Vesselin Mirewski
<v.mirewski at bugsys.org> wrote:
> Hi, I have troubles with formfu checkboxgroup/DBIx. I build a very
> simple example of standard mapping in Catalyst 5.90016. ( Same problem
> I got with earlier versions of all components )
>
> The following example populates all the selected "categroies" ( e.g.
> content in the example ) but throws exception when trying to update.
> Seems like DBIx doesn't pass the schemaname ( 'page_content_map'
> instead of 'web.page_content_map' ) or perhaps is it somehow connected
> with perlbrew ... ?
>
> I have build the model with 'qualify_objects=1 db_schema=SCHEMANAME'
> and the correct prefix is in all models and resultsets.
>
> Thanks for any help in advance.
>
> Follows the declaration of the 3 tables + yml + DBI exception.
>
> __PACKAGE__->table("web.page");
>
> __PACKAGE__->has_many( "page_content_maps",
> "Web::Schema::Result::PageContentMap",
> { "foreign.page_id" => "self.id" },
> { cascade_copy => 0, cascade_delete => 0 },
> );
>
> __PACKAGE__->many_to_many( 'content' => 'page_content_maps', 'content' );
>
> __PACKAGE__->table("web.content");
>
> __PACKAGE__->has_many( "page_content_maps",
> "Web::Schema::Result::PageContentMap",
> { "foreign.content_id" => "self.id" },
> { cascade_copy => 0, cascade_delete => 0 },
>
> );
>
> __PACKAGE__->many_to_many( 'page' => "page_content_maps", 'page' );
>
> __PACKAGE__->table("web.page_content_map");
>
> __PACKAGE__->belongs_to( "content", "Web::Schema::Result::Content",
> { id => "content_id" },
> { is_deferrable => 1, on_delete => "CASCADE", on_update =>
> "CASCADE" },
> );
>
> __PACKAGE__->belongs_to( "page", "Web::Schema::Result::Page",
> { id => "page_id" },
> { is_deferrable => 1, on_delete => "CASCADE", on_update =>
> "CASCADE" },
> );
>
> edit.yml given an existing entry of model Web::Page as default :
> ...............
> - type: Checkboxgroup
> name: content
> label: Content
> model_config:
> model: 'Web::Content'
> ............
>
> DBI Exception: DBD::Pg::st execute failed: ERROR: relation
> "page_content_map" does not exist LINE 1: DELETE FROM
> "page_content_map" WHERE ( "page_id" = $1 ) ^ [for Statement "DELETE
> FROM "page_content_map" WHERE ( "page_id" = ? )" with ParamValues:
> 1='2'] at /home/bugsy/perl5/perlbrew/perls/perl-5.16.1/lib/site_perl/5.16.1/DBIx/Class/Schema.pm
> line 1101.
>
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
More information about the HTML-FormFu
mailing list