[Maypole] mixing of tables in create

Josef Chladek j.chladek@wirtschaftsblatt.at
Tue, 1 Feb 2005 17:37:01 +0100


Am 31.01.2005 um 21:17 schrieb Peter Speltz:

>
> --- Josef Chladek <j.chladek@wirtschaftsblatt.at> wrote:
>
>> i'm fairly new to maypole, so excuse me if i'm asking something purely
>> trivial. i've been studying the docs and examples but can't figure out
>> how to realize mixing of textfields/areas from DIFFERENT tables in one
>> create/edit
>>
>> create table article (id int not null auto_increment primary key,
>>                        title varchar(100),
>>                        lead text);
>>
>> create table textblock (id int not null auto_increment primary key,
>>                          article integer,
>>                          block text);
>>
>> an article has many textblocks.
>>
>> what i want to realize is a create mask, which has
>>
>> title
>> lead
>> block [0..n]
>>
>> in it. it seems that i'm only able to create the article FIRST, and
>> then start adding blocks that i assign to the article. for an article
>> this is not the most desired workflow...
>>
>> thanks
>> josef
>>
>
> Hi josef.
>
>  I assume you're using default "FromCGI::create_from_cgi" sub to 
> create your
> objects. This is a limitation of that -- it doesn't create objects 
> with many
> components very well..  It could probably be overriden to 
> automatically add
> your blocks to the article.  I'd be interested in a solution to this 
> if you
> write one. I've thought about doing this for a while but haven't 
> gotten around
> to it.

hello peter,

yes, i'm using the FromCGI, but as my knowledge of maypole is that of a 
beginner (not to speak of CDBI) at the moment i have NO clue where to 
implement that (override the do_edit? how and where could i override 
the create_from_cgi? ...)

as i read on www.spanner.org 
(http://www.spanner.org/lists/cdbi/2004/11/04/54ea4da4.html)

> There's been talk a few times of having Class::DBI's normal create() be
> able to take arguments for related classes as well, and do the right
> thing. Nothing's really ever come of it, but if it did, then this may
> help with your problem (rather than trying to handle it in
> create_from_cgi itself).
>
> Tony

any progress on that, or any plan to implement that in cdbi in the near 
future?

thanks
josef