Hi guys,

Thank you for responding to my mail. First of all, yes, I'm talking about inter-model links rather than controller-model links. I suppose it's the idea of the relationships that has me confused. I'm trying to design in such a way that each object is as independent as possible. I've been reading as much as possible (maybe too much) about good design lately and of course a good portion of this material has related to Java without mention of any databases. I'm therefore wondering how possible it is to have objects which are independent to each other when they all act on the same database.

For example:
The good old shopping cart scenario:
If I want to add a product to the cart from inside the Cart model, I may have a method called addItemToCart() which might include a call to $this->CartItems->save($details);
If I want to list the details of the items from the CartsController's view action, I might have a method in the Cart model called getProductDetails($product_id) which might include a call to $this->CartItems->Products->find($product_id).

It seems to me that these objects need each other to operate because their models are related (which is unavoidable). So either my understanding of low coupling / high cohesion is all messed up, or it's just hard to do when there's a relational database involved.

If my understanding is correct, then using the $uses array from the controller will make things look tidier from the controller and allow you to use unrelated models but doesn't take away the dependencies between model objects.

Does what I'm saying make any sense?

Cheers,

Sonic

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to