Monday, January 10, 2011

Re: Component or Behavior?

Consider database triggers.
I recommend using database trigger for REALLY simple situations that involve no more then 3 line of code.

In you example pseudo code should looks something like this.
After update trigger on competitions .
#If NEW.complete == yes
#Select awardpoints into new_points from competitions
#Update users set points = new_points where id = user_id;

Its better to call stored procedures from within the trigger to do the job.

For more complicated situations create a stored procedure in the database and call this procedure from your model aftersave(); 

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate