[Typo3-dev] Data-Modell Problems

Thomas Murphy murphy at spreekonzept.de
Thu Jun 30 17:31:26 CEST 2005


Hello Thomas,

Waggershauser, Thomas wrote:
> This EventDB differs from existing Extensions in one point: Events are independend of one special Date/Time and can have different, completely independend Date/Time combinations.
> For that i need a "1:n" Relation, but very specific. All "n"-Parts are only for "1" and nothing else. 
> 
> For better Integration in the "1"-Part im using a blob with a comma separated List, pointing to the "n"-Table.
> I think i need another reference from "n" to 1 to fix this connection...

I think I know your problem as I've encountered something similar myself 
(when writing an eventDB by the way...). I also wanted to create 
something I called a 'timepattern' to set the date for an event. Every 
event should have an arbitrary amount of timepatterns associated with it 
(and only with this event, no other).
A timepattern is a record from another DB with several fields of it's own.

I solved it like that:

"foreign_table_where" => "AND tx_myext_timepattern.pid=###CURRENT_PID### 
AND tx_myext_timepattern.event=###THIS_UID### ORDER BY 
tx_myext_timepattern.uid",

...so I have a field in the timepattern table that associates the record 
with that event. Unfortunately, when you create a new event, this event 
has to be saved before you can create those patterns, because TYPO3 
works with a temporary uid until you save the record for the first time.

To solve this I am still working on a solution which involves extending 
the "foreign_table_where" with :

"foreign_table_where" => "AND tx_myext_timepattern.pid=###CURRENT_PID### 
AND (tx_myext_timepattern.event=###THIS_UID### OR 
tx_myext_timepattern.event='###REC_FIELD_[newid]###') ORDER BY 
tx_myext_timepattern.uid",

and I save the temporary uid into the timepattern (and the event record) 
when no "real one" is created by now (So I can filter the select by 
event_uid and the former temporary_uid).

I also use:

"JSopenParams" => "height=350,width=580,status=0,menubar=0,scrollbars=1",
"script" => t3lib_extMgm::extRelPath('myext')."classes/wizard_add.php",

to open a new window to enter timepatterns and refresh the parent frame 
once I'm finished.

But all of this just gets more and more ugly and I know it's not a very 
stable or clean solution.
But let me know if you find one - I have to get into that topic again 
this weekend, when I have to finish my version of the eventDB-ext. :)

Maybe there is some magic in the flexforms, because there seems to be a 
basic support for repetetive data objects (a 1:n relationship):
http://typo3.org/documentation/document-library/doc_tut_ftb1/Content_Element_with/

the long weekend will tell ;)

bye,
Murphy







More information about the TYPO3-dev mailing list