Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorsuthern


    I'm writing some more software using this framework, and was wondering if there's a way to check to see if a record was created or updated after calling save(). I have a function in beforeSave() that checks some additional fields to see if the new entry is a duplicate. If it is, then it sets the ID, and _newRecord to true.

    That's why it'd be nice to be able to check to see if the last save() actually created or updated the record.


    • CommentAuthorsuthern

    Just to clarify, this is from the controller's point of view. I'd like to have words in my notice like "3 new records and 5 updated records"

    • CommentAuthorsuthern

    I cheated.

    In my model, I create and update two values, model->num_updated and model->num_created, depending on which occured. Then in the controller I read those values, and presto, I have how many were updated or created.

    It would be nice if there was a native function or property of the model that I could refer to after each save(), but the above workaround does work.