[TYPO3-mvc] Owner of a relation

Lorenz Ulrich lorenz-typo3 at visol.ch
Fri Jan 20 20:27:45 CET 2012


Hi everyone

Quite some time passed by since this post and I wanted to continue my 
work on this.

When investigating how Extbase stores relations, I found out that all MM 
relation rows are deleted when its parent is touched. So it's no 
alternative to simply work around Extbase and manually store and read a 
user id to a custom field in the MM table.

Does anyone have another idea how to achieve my requirements?

In short: A user can add tags to an (artistical) work. Furthermore he 
can delete relations to tags (not the tags themselves), but only the 
ones he added himself. Therefore, I need some mechanism to save and read 
the owner of a tag MM relation.

Thanks in advance and best regards,

Lorenz

Am 26.11.2011 14:33, schrieb Lorenz Ulrich:
> Hi everyone
>
> I have a requirement I already have a pragmatic solution for, but I
> would like to find out if there are better solutions out there.
>
> Frontend users of a website can add tags to items in the database. This
> is done through an MM table. If a tag doesn't exist yet, then it's
> created (transparently) in the tag table and afterwards a relation to
> the tag is added to the database item.
>
> Now I like to allow the creator of the relation to remove the relations
> (not the tags) he created. Therefore I would extend the MM table with a
> field "user" that stores the FE user id.
>
> My practmatic approach would be to add a method similar to this in the
> repository:
>
> findTagOwner($uidItem, $uidTag)
>
> That calls a manual query statement delivering the id of the FE user. In
> the controller I compare it to the logged in user and will then decide
> whether there will be a delete icon in front of the tag, the tag
> relation can be deleted etc.
>
> If anyone of you knows of a better approach, I would be happy to read it
> :-).
>
> Thanks and best regards,
>
> Lorenz



More information about the TYPO3-project-typo3v4mvc mailing list