Code or Databases????

2006-10-25 Thread Sonic Baker
Hi there,I've read before that it's faster and even recommended to sum values at the DB level through queries. So if I wanted to get a list of items sold between certain dates, calculate tax totals, etc I should do this through queries. However, I'm not sure how portable it would be to do this

Re: Code or Databases????

2006-10-25 Thread Chris Hartjes
On 10/25/06, Sonic Baker [EMAIL PROTECTED] wrote: Hi there, I've read before that it's faster and even recommended to sum values at the DB level through queries. So if I wanted to get a list of items sold between certain dates, calculate tax totals, etc I should do this through queries.

Re: Code or Databases????

2006-10-25 Thread Sonic Baker
Hi Chris,Thanks for your response. I guess to stick with cake's portability I'll do these sort of tasks in the Domain logic.For future reference, if anyone's wondering about this question, and they are good enough to search the list before posting, here's a link to help you decide:

Re: Code or Databases????

2006-10-25 Thread [EMAIL PROTECTED]
This is an issue that comes back in many domains. my view on it , is basically: the more layers of abstraction you make to interact with a resource, the more simple that interaction becomes, but also, the more generic. And thus, the less you can optimize those interactions. (well offcourse you

Re: Code or Databases????

2006-10-25 Thread Chris Hartjes
On 10/25/06, Sonic Baker [EMAIL PROTECTED] wrote: Hi Chris, Thanks for your response. I guess to stick with cake's portability I'll do these sort of tasks in the Domain logic. For future reference, if anyone's wondering about this question, and they are good enough to search the list

Re: Code or Databases????

2006-10-25 Thread Sonic Baker
Hi Chris,On 10/25/06, Chris Hartjes [EMAIL PROTECTED] wrote: That's a really great article.I've printed it out to read on thetrain ride home tonight.I'm doing some refactoring of an existingapplication (Rails, not CakePHP) and have to make some decisions about this very topic.Greatly

Re: Code or Databases????

2006-10-25 Thread nate
Theoretical Example: Order hasMany OrderItem, OrderItem belongsTo Order, Item: $this-OrderItem-find( 'Order.date BETWEEN ' . date('Y-m-d') . ' AND ' . date('Y-m-d', strtotime('-1 month')) . '', 'SUM(Item.price) As total' ); If you wanted to calculate that including the tax per order,

Re: Code or Databases????

2006-10-25 Thread Sonic Baker
Hi Nate,Thank you for your input.On 10/25/06, nate [EMAIL PROTECTED] wrote: Theoretical Example: Order hasMany OrderItem, OrderItem belongsToOrder, Item:This is interesting. I have these Modles, however my setup is Order HABTM Item (link table Items_orders). Then when I want to add items to the

Re: Code or Databases????

2006-10-25 Thread nate
This is interesting. I have these Modles, however my setup is Order HABTM Item (link table Items_orders). Then when I want to add items to the order I use bindModel to create a hasMany association between Order and ItemsOrder. I'm interested to know why you chose the above associations?

Re: Code or Databases????

2006-10-25 Thread Sonic Baker
Hi Nate,On 10/25/06, nate [EMAIL PROTECTED] wrote: This is interesting. I have these Modles, however my setup is Order HABTM Item (link table Items_orders). Then when I want to add items to the order I use bindModel to create a hasMany association between Order and ItemsOrder. I'm interested to