Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users
edit has_many relation with FormFu
 

Index | Next | Previous | View Flat


davewood at gmx

Oct 24, 2008, 1:08 AM


Views: 894
Permalink
edit has_many relation with FormFu

Hello List.

I want to edit a m:n relation between projects and pictures (a project
may have many pictures). It is displayed correctly but upon submit the
following error message occurs:
NOTE: 7 is the project ID which seems to be interpreted as a column name

DBI Exception: DBD::SQLite::db prepare_cached failed: near ".7":
syntax error(1) at dbdimp.c line 271 [for Statement "SELECT
me.picture_id, me.project_id, me.position FROM picture_projects me
WHERE ( ( ( me.7 IS NULL ) AND ( me.project_id = ? ) ) )"] at
/usr/local/share/perl/5.8.8/DBIx/Class/Schema.pm line 954

in this line in Controller/Projects.pm:
>if ($form->submitted_and_valid) {
> $form->model->update($project);


Any help is highly appreciated as I am stuck with this problem since a
few days already.

in lib/MyApp/Schema/Projects.pm:
> __PACKAGE__->has_many(picture_projects => 'Oberhumer::Schema::PictureProjects', 'project_id');
> __PACKAGE__->many_to_many(pictures => 'picture_projects', 'picture');

in myapp02.sql:
>CREATE TABLE pictures (
> id INTEGER PRIMARY KEY,
> title TEXT,
> info TEXT,
> filename TEXT,
> created datetime
>);
>
>CREATE TABLE picture_projects (
> picture_id INTEGER,
> project_id INTEGER,
> position INTEGER,
> PRIMARY KEY (project_id, picture_id)
>);

in root/forms/projects/formfu_create.yml:
>- type: Repeatable
> nested_name: picture_projects
> elements:
> - type: Hidden
> name: project_id
> - type: Hidden
> name: picture_id
> - type: Text
> label: Position
> name: position

with friendly greetings
David Schmidt

--
David Schmidt | http://www.fm5.at

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/

Subject User Time
edit has_many relation with FormFu davewood at gmx Oct 24, 2008, 1:08 AM
    Re: edit has_many relation with FormFu hutchinson.chris at gmail Oct 26, 2008, 2:59 PM
    Re: edit has_many relation with FormFu davewood at gmx Oct 27, 2008, 2:23 AM
    Re: edit has_many relation with FormFu davewood at gmx Oct 27, 2008, 3:27 AM
    Re: edit has_many relation with FormFu learn.catalyst at gmail Apr 11, 2012, 7:53 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.