Re: Problem with linked models

2009-04-16 Thread Toby
Ah. My fault. It would appear that I had a condition in the belongsTo relationship that was not needed... 'conditions' => array('Size.size_type_id' => 'StockItem.Product.size_type_id'), Thanks for your help. T On Apr 16, 2:49 pm, Grzegorz Pawlik wrote: > here: (`StockItem`.`size_id`

Re: Problem with linked models

2009-04-16 Thread Grzegorz Pawlik
here: (`StockItem`.`size_id` = `Size`.`id` AND `Size`.`size_type_id` = 'StockItem.Product.size_type_id') After 'AND' you have something that is not automatically generated by cake. You must have something extra in StockItem->find() passed, or in relation definition (ie. in conditions field). Pleas

Re: Problem with linked models

2009-04-16 Thread John Andersen
In your controller, which fetches all the StockItems for a given product, how does it do that? Sorry for asking, but I do not see anything automatically fetching the required information, but I don't know all about CakePHP yet :) If you know the product, then you should fetch the stockitems from

Re: Problem with linked models

2009-04-16 Thread Toby
There isn't a find call, I was relying on automatic call, as this seems to get it almost right. Do I need to specify the find call myself then? T On Apr 16, 6:24 am, John Andersen wrote: > How does the find call look like in your controller? >    John --~--~-~--~~~-

Re: Problem with linked models

2009-04-15 Thread John Andersen
How does the find call look like in your controller? John On Apr 16, 12:41 am, Toby wrote: > I have a problem with an SQL call. > > I have the following tables, linked as shown... > > SizeType -> hasMany Products > SizeType -> hasMany Sizes > Product -> hasMany StockItems > Size -> hasMany St

Problem with linked models

2009-04-15 Thread Toby
I have a problem with an SQL call. I have the following tables, linked as shown... SizeType -> hasMany Products SizeType -> hasMany Sizes Product -> hasMany StockItems Size -> hasMany StockItems When my controller attempts to fetch all the StockItems for a given product the SQL it generates doe