Tuesday, April 16, 2013

Calling arbitrary methods

I'm learning CakePHP 2.0 and MVC. Having trouble grasping the whole MVC thing. I have working models, controllers and views for all of my objects. Now I'm trying to do several things at the same time.

Overview:
 - Organizations have monthly Account balances
 - Divisions belong to organizations and also have Account balances
 - Facilities belong to divisions and also have Account balances

For ease of use, I have stored all three sets of account balances in different SQL tables until I learn more about MVC.

I'm trying to create a method in the correct place to be able to

 1. Get the current balance for each division and facility within a given organization
 2. Update all balances for all facilities and divisions within a given organization at the same time

I've managed to create a Balances->update($facility_id) for one facility, but I need to do them all at once and I can't figure out where to put it and how to use the collective info from all of the Objects. I tried helpers. I tried a new model and controller. I think I was close with a helper, but I'm creating Objects in the Helper to do queries for the current balance and I know that's not MVC-smart.

Also, I haven't figured out how to trigger the method if it's not within a Controller, but that issue may resolve itself. Help?!

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: