Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorsuthern
     
    I have a simple table called 'list_prices'.

    The noteable columns are id, code, and manufacturer_id.

    Three keys are defined: (id->PRIMARY, code+manufactuer_id->UNIQUE, manufactuer_id->INDEX)

    When I do a save() with an object (which does not have it's 'id' set), Akelos should recognize if a record already exists with the same code+manufacturer_id UNIQUE key, and simply do an UPDATE on it.

    As it is, Akelos simply reports the mysql error DUPLICATE ENTRY.

    I realize I could do a find() to detect if the record already exists, then do an update or create. But that seems redundant because ->save() should do the update or create.

    Is there a way to tell Akelos about this multiple-key field so it is checked while doing a save()?

    Thanks!
    • CommentAuthorsuthern
     
    I'm not longer seeking an answer to this, as now I'm using custom SQL to insert all the records (as many as 5000 in one go). It's much faster and way less overhead.

    Perhaps someone else is looking for an answer to the same problem?

    -Suthern
    • CommentAuthorKaste
     

    I realize I could do a find() to detect if the record already exists, then do an update or create. But that seems redundant because ->save() should do the update or create.

    Is there a way to tell Akelos about this multiple-key field so it is checked while doing a save()?

    yes, but you have to do it by yourself ;-) either using the validation* or before* callbacks.

    • CommentAuthorsuthern
     

    Ahh, ok. Thanks Kaste!