Thanks a lot, I looked into behaviours, they do look interesting indeed, but I'd like to have all the abuse information in one table. so I followed your advice and replaced enum with string(20) cheers Marco
On Oct 3, 12:52 am, Gareth McCumskey <[email protected]> wrote: > Your first solution is nice and simple but it has one big flaw. Because you > use enum if you want to add another type later that means you now have to > edit database schema to accomplish it. > > One tactic which might work better is instead of enum'ing a few types just > use the table name as the "type" and your code can dynamically look for > matching table names of abuse instead. Also, this means that should you need > another type just go ahead and use it without worrying. > > > > On Fri, Oct 2, 2009 at 4:11 PM, mbernasocchi <[email protected]> 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 > > -- > Gareth McCumskeyhttp://garethmccumskey.blogspot.com > twitter: @garethmcc --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---
