Re: [Maypole] mixing of tables in create

From: Josef Chladek (j.chladek at wirtschaftsblatt.at)
Date: Wed Feb 02 2005 - 16:35:42 GMT


Am 01.02.2005 um 18:09 schrieb Peter Speltz:

> I was thinking override create_from_cgi. you should just be able to
> put a sub
> in your base model class (or just class you want the override) called
> create_from_cgi.

ok, so i did, this opens a can of worms for me:

sub create_from_cgi {
     my $class = shift;
     my $article = $class->SUPER::create_from_cgi(@_);
     my $textblock = Article::Textblock->create_from_cgi(@_);
     $textblock->article($article->id);
     $textblock->update;
     $article;
}

with this i was able to insert the title, lead along with one block in
the two tables.

1) i hardcoded the formfield in the addnew template, how could this be
done automatically? Article::Article->columns(All => qw/title lead
block/) is not the way, it of course tries to retrieve the value of
block in the article table
2) related to this, what has to be done in the edit template
3) what about multiple blocks? how should the formfields be named
(block -> i get an array), block1, block2 ... -> this breaks the
automatic insertion)

can someone point me in the right direction please?
thanks
josef

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:58 GMT