Re: The best database setup for this?

2009-06-09 Thread Travis L
Agreed with Brian. It may seem like the table is getting huge (which it eventually will). But you're just keeping record of 2-3 INT data types (depending on how you do the key), so much of it will fit into memory anyhow. I wouldn't worry too much about join tables being a source of slowness

The best database setup for this?

2009-06-08 Thread Céryl
Hello all, Little question: Say, i have two tables, USERS and PRODUCTS, for arguments sake. Now, all the products in the PRODUCTS table are unique by some value, say barcode, so it doesn't allow duplicates of the same product in the table. Now, a user can have several products associated with

Re: The best database setup for this?

2009-06-08 Thread Martin Westin
$hasAndBelongsToMany A User can have many Product(s) in hist shopping cart or something. A Product can be in (have) many User's carts. On Jun 8, 4:03 pm, Céryl c.a.h.wilt...@student.tue.nl wrote: Hello all, Little question: Say, i have two tables, USERS and PRODUCTS, for arguments sake.

Re: The best database setup for this?

2009-06-08 Thread Céryl
Ah, i saw it often, but I nevert had to use that link. Thansk for the fast reply! This Googlegroup never let's me down! :D Anyway, it works, I get the right array from the database now, but how can I make a SQL-query on this relationship that let's me get all the products by a certain user? I

Re: The best database setup for this?

2009-06-08 Thread brian
Use ContainableBehavior: $this-User-find( 'first', array( 'conditions' = array( 'User.id' = $user_id ), 'contain' = array( 'Product' ) ) ); On Mon, Jun 8, 2009