Search Results

Search found 1 results on 1 pages for 'user636901'.

Page 1/1 | 1 

  • Representing versions of objects with CakePHP

    - by user636901
    Hi people, Have just started to get into CakePHP since a couple of weeks back. I have some experience with MVC-frameworks, but this problem holds me back a bit. I am currently working on a model foo, containing a primary id and some attributes. Since a complete history of the changes of foo is necessary, the content of foo is saved in the table foo_content. The two tables are connected through foo_content.foo_id = foo.id, in Cake with a foo hasMany foo_content-relationship. To track the versions of foo, foo_content also contains the column version, and foo itself the field currentVersion. The version is an number incremented by one everytime the user updates foo. This is an older native PHP-app btw, to be rewritten on top of Cake. 9 times out of 10 in the app, the most recent version (foo.currentVersion) is the db-entry that need to be represented in the frontend. My question is simply: is there someway of representing this directly in the model? Or does this kind of logic simply need to be defined in the controller? Most grateful for your help!

    Read the article

1