[TYPO3-core] RFC: Bidirectioanl MM relations

Kasper Skårhøj kasper2006 at typo3.com
Mon Sep 11 12:29:26 CEST 2006


>> A vision (not for this patch) is that one day the MM-tables can  
>> contain
>> additional fields with information that says something about the
>> relation. However, that requires quite some changes, among others  
>> that
>> MM-table relations are not "deleted/created again" as they are now in
>> TCEmain.
>
> We already switched from doing a delete/create-again to an
> update/insert-if-not-existing in order to maintain the sorting on the
> "other side".

OK,

>
>> Further, it would need a change so relations communicated
>> to/from TCEmain and TCEforms is more than just a table_uid string.
>> Hmm... And finally, such as the T3D format must support it also.
>
> Right. Apart from I guess storing additional information attached to a
> relation would need changes to the user interface to comfortably edit
> those added infos.

Yes,
>
> The best way would be if the refindex offered a way to store the
> relation only as one refindex-record but it would automatically appear
> on both sides of the relation.

I'm not in favour of that.
The idea is that with the ref index you look up on the tablename and  
rec_uid columns and they you have all relations flowing out from that  
record. So if the bi-directional relations are supposed to show up  
for a record when doing so, there has to be duplicate entries. But  
I'm not sure if the bidirectional relations are supposed to  
technically be bidrectional or if it is more like a pleasant feature  
of the interface...


>
> The second best way IMHO is registering the relation only once as a
> relation from the local to the forein side.

This is how it would work for now with no change.

> Therefore, when you
> add/remove relations while editing the foreign side, it should add or
> remove sys_refindex entries for the local side pointing to the record
> you're editing.

Yes, this is the challenge; That we must also update the local side  
when editing the foreign. Thats the issue I mention below:

>
>> Anyway, the more SERIOUS problem with sys_refindex is this: Say  
>> you edit
>> pages:2 and remove the reference to pages:1. Now pages:1 only  
>> points to
>> "pages:3". However, in sys_refindex there will still be a reference
>> recorded to both pages:2 and pages:3 because when saving pages:2  
>> the API
>> call is only made for pages:2 - but it should also be made for any  
>> added
>> or removed reference!
>
> Yes, this would become a problem if you'd put each relation into
> sys_refindex twice, because the local side can't guess from its TCA
> config whether there's an opposite field configured for the relation.

I think you misunderstood: This problem has nothing to do with single  
or redundant entries in sys_refindex. THe point is that when you edit  
the foreign side records they may add or delete references which  
requires a call to the sys_refindex api for the local side records to  
update them. This is true even if we do NOT put in redundant entries.

>
>> I didn't look at the code, but either this should be done in  
>> TCEmain -
>> or maybe in sys_refindex. Because when you call sys_refindex to  
>> update
>> itself it will look for what references was added and which was  
>> removed
>> and for each we could call itself redundantly of course to update  
>> those.
>> That would in fact have the most general character.
>>
>> I'm willing to implement this for you guys when I get a chance to  
>> test
>> your work. Currently, I'm on an island for myself since my Mac
>> completely refuses any SVN connections with any client application  
>> and I
>> don't know what to do...
>
> Great. What would you suggest, should we already commit the stuff and
> you'll add the refindex stuff later?

Yes, commit the stuff, then send me a notification and I will take a  
look at it and decide what to do.

- kasper



>
> cheers
> Ingmar
> _______________________________________________
> TYPO3-team-core mailing list
> TYPO3-team-core at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-team-core



- kasper

"Gimme Five!"
-------------------------------
kasper2006 at typo3.com | +45 20 999 115 | skype: kasperskaarhoej |  
gizmo: kasper_typo3






More information about the TYPO3-team-core mailing list