Consider writing a behavior - which you can then attach to whatever tables you wish.
Checkout: http://www.doctrine-project.org/documentation/manual/1_1/en/behaviors On Fri, 02 Oct 2009 16:11:23 +0200, mbernasocchi <mbernasoc...@gmail.com> wrote: > > Hi I've a question regarding how to design a feature of my project. > my project has a question/answer section, a forum section and a > tutorial section. > I want to add a "flag as inapropriate" functionality to each of the > tables (question, answer, forum, forum_comment, recipe, > recipe_comment). I want to have a table where i store who flagged > which object. if the same object if flagged twice then it's 'is_abuse' > field is set to true and the abuser's account is blocked. > > now I'we two ideas how to solve this and Im wondering which one you > consider better: > > 1. create a single table with object_type and object_id as attribute > [code]AbuseFlags: > columns: > object_type: > type: enum > values: [question, answer, forum, forum_comment, recipe, > recipe_comment] > primary: true > notnull: true > object_id: > type: integer(4) > primary: true > notnull: true > flagger_user_id: > type: integer(4) > primary: true > notnull: true > abuser_user_id: > type: integer(4) > primary: true > notnull: true > [/code] > > 2. create a separate table (like a m:n relation) for each object type. > [code]ForumCommentsAbuseFlags: > columns: > forum_comment_id: > type: integer(4) > primary: true > notnull: true > flagger_user_id: > type: integer(4) > primary: true > notnull: true > abuser_user_id: > type: integer(4) > primary: true > notnull: true > [/code] > > > or do you have a better idea, I'm shure this has been done a coupple > of times allready! > As far as i'm concerned I wouldent mind having some model method > taking care of getting the table name of the offending object and set > it as object_type in the AbuseFlag table.I was just wondering if from > a design (and symfony -my first project with it-) point of view which > one made more sense > > thanks a lot > Marco > > -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---