[TYPO3-mvc] Owner of a relation
Lorenz Ulrich
lorenz-typo3 at visol.ch
Sat Nov 26 14:33:41 CET 2011
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