[TYPO3-mvc] relations with metadata

Pascal Jungblut mail at pascal-jungblut.com
Thu Jun 3 12:34:27 CEST 2010


Hi everyone,

I'm currently working on tx_community for the Google Summer of Code and, starting with profiles, I have a question about relations. In particular it's about the friendship (yes, that's the common term in social networks) between users.
When one user wants to add another user as a friend, the other one gets notified and has to confirm the friendship. My question is how to technically implement those relations. Ingo and I have had several ideas:

1. A normal relation-table. When user1 requests a friendship, a relation between user1 and user2 is added. When user2 accepts, a relation from user2 to user1 is also added and the friendship is accepted. This is my personal favorite. However, it might have two disadvantages:
- this method cannot store any metadata regarding the relation (besides accepted or not). Something like "added on 03.06." or "recommended by Kasper" could not be saved. Of course, that's no the first thing I'd like to implement, but I keep that in mind
- performance: I'm not quiet sure about this. Just imagine the xx.000 users on typo3.org and every time their friends get listed, Extbase asks the database "give me everyone with a relation from a to be and b to a".

2. A relation model that can handle also meta information about the relation. It has a property "members" (or memberA and memberB, but I think it would be ugly). I'm not sure about performance here either and in the DDD sense, this is at least problematic.

3. A normal relation-table with metadata. Only the relation from user1 to user2 is stored, together with the information whether the friendship was accepted. But I don't think that Extbase can handle or manipulate any metadata in the relation-table. Also this is asymmetric as only user1 has a direct relation to user2 and that doesn't model the friendship very well.

It would be really great if you could share your thoughts on this. And, if you have other ways in mind to realize that, please let me know. I just don't want to implement a fundamental feature like this wrong.

Regards
Pascal


More information about the TYPO3-project-typo3v4mvc mailing list