Hi Greg, thanks for your response.

Your transactions table idea is what I was thinking of originally, so I'm glad 
to hear confirmation that this could be a good way to do it, but I wasn't sure 
whether that would be instead of or in addition to CakePHP's usual way of 
managing relationships. For example, before implementing a transactions table, 
my books table might have the columns id, name, and user_id (the id of the user 
who currently has the book checked out, which could be NULL). Now, after I add 
a transactions table, do I still have a user_id column in the books table 
(redundant with the information in the transactions table), or do I remove it 
(if so, how does CakePHP manage the relationships now?)

My system tracks more resources than just books, so I suppose I'll need 
multiple transactions tables (book_transactions, etc.)


On Jan 19, 2011, at 02:34, Greg Skerman wrote:

> i'd have a transactions table, which is made up of id, book_id, user_id, 
> checked_out, checked_in
> 
> When a checkout is made, create a  new row, date time in checked_out
> when its checkedin, update the checked_in date.
> 
> 
> 
> On Wed, Jan 19, 2011 at 5:52 PM, Ryan Schmidt wrote:
> 
>> How would you manage a system with a table for users and tables for various 
>> resources and the need to track which users used which resources for how 
>> long (so that they can be billed for it)?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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