CRUD controllers

Discussion in 'PHP' started by mcdeere02, Aug 5, 2009.

Thread Status:
Not open for further replies.
  1. #1
    For a long time I've been using the same template for adding content as for editing content. However, I've always been using separate controllers. Seems to me that's leading to a lot of duplication. So I'm wondering: do you use separate controllers (or methods) for adding/editing, or do you have conditionals to determine whether to insert or update?
     
    mcdeere02, Aug 5, 2009 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    all seperate, so its easy to fix problems and not killing the whole site when making one little mistake! :)
     
    EricBruggema, Aug 5, 2009 IP
  3. nomzz

    nomzz Well-Known Member

    Messages:
    475
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    110
    #3
    as far as i know all frameworks like strutcs wickets springs and other also handle edit delete update all seperately ...yep can do persistency but functions are the behaviors which should be change or you can do overloading
     
    nomzz, Aug 5, 2009 IP
  4. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Normally you have different controller methods because there may be a few differences. However, you can have the same validations.. Most frameworks do this with the model validation. (And adding or removing specific validations for add/update)
     
    premiumscripts, Aug 5, 2009 IP
Thread Status:
Not open for further replies.