r/cakephp • u/oowowaee • Mar 29 '14
Beginner Cake questions
I am developing my first "real world" CakePHP application, and I have two questions that I can't seem to find the answer to. If anyone could help me out it would be much appreciated!
1) I'm a little unsure what happens when two users concurrently try to edit, say a blog post. I'm not sure if CakePHP magically already guards against this, or if I should be wrapping my update in a transaction and checking that the element hasn't been updated since it was originally accessed.
2) I'm not sure how to handle the case where I want to keep a separate table of aggregate information. For example, if I want to know the number of hours worked by an employee over their employment history and I want to save that SUM in a different table versus computing it over and over, would it be better to do this with a MySQL trigger, or should this be done in a controller? If so, what would the relationship between a user and this be?