Re: More HABTM questions - querying data

2009-07-08 Thread Alastair
Hi Robert, Thanks for your help with this although it doesn't appear to be quite working. It's certainly returning just members however it is returning ALL members. I'm assuming when you said AppController you meant AppModel for the actsAs('Containable')? The code I'm using is as follows: App

Re: More HABTM questions - querying data

2009-07-08 Thread Robert P
Ah yes, I did mean AppModel. Either that or my local copy of Cake is based on CVM. I can't seem to get ContainableBehaviour to work either. It keeps trying to query the database using contain instead of SQL. Time to fall back to a custom join perhaps? $joins = array( array(

Re: More HABTM questions - querying data

2009-07-08 Thread Robert P
Refactored to remove unnecessary table. $joins = array( array( 'table' = 'counties_users', 'alias' = 'CountiesUsers', 'type' = 'INNER', 'conditions' = array('Member.user_id = CountiesUsers.user_id') ), array(

Re: More HABTM questions - querying data

2009-07-08 Thread Alastair
On Jul 8, 12:43 pm, Robert P shiftyrobs...@gmail.com wrote: Refactored to remove unnecessary table. $joins = array(         array(                 'table' = 'counties_users',                 'alias' = 'CountiesUsers',                 'type' = 'INNER',                 'conditions' =

RE: More HABTM questions - querying data

2009-07-07 Thread Dave Maharaj :: WidePixels.com
Use contain There is a chapter in the cookbook how to get only the records from related models and not pull all the un-necessary info. Dave -Original Message- From: Alastair [mailto:m...@alastairmoore.com] Sent: July-07-09 10:31 PM To: CakePHP Subject: More HABTM questions -

Re: More HABTM questions - querying data

2009-07-07 Thread Robert P
Matt Curry does a good job of providing a default model setup for any new application. If AppController doesn't already exist, create /app/ app_controller.php and add the following class, or copy the attributes into your current one: class AppController extends Controller { var