Hope you enjoyed your holiday.
The query:
"SELECT `Cat`.`id`, `Cat`.`title`, `Cat`.`location_id`,
`Cat`.`created`, `Cat`.`modified` FROM `cats` AS `Cat` WHERE
`Subcat`.`cat_id` = `Cat`.`id`"
Cannot originate from the call:
$this->set('local', $this->paginate('LocalInfo'));
If you have force join
Hi Paul,
been on holiday for a week.
Here's the error I am getting:
$sql= "SELECT `Cat`.`id`, `Cat`.`title`, `Cat`.`location_id`,
`Cat`.`created`, `Cat`.`modified` FROM `cats` AS `Cat` WHERE
`Subcat`.`cat_id` = `Cat`.`id` "
$error = "1054: Unknown column 'Subcat.cat_id' in '
Hi Paul,
been on holiday for a week.
Here's the error I am getting:
$sql= "SELECT `Cat`.`id`, `Cat`.`title`, `Cat`.`location_id`,
`Cat`.`created`, `Cat`.`modified` FROM `cats` AS `Cat` WHERE
`Subcat`.`cat_id` = `Cat`.`id` "
$error = "1054: Unknown column 'Subcat.cat_id' in '
Something going wrong in your associations or bindings as
Subcat.cat_id is in a directly related model. Can you supply the
associations for the model you are running find from, then your
bindings you are applying, the find command you are running and the
resulting SQL that it's having problems wit
Thanks for your response. Changing true => false still throws some
errors (below) but it seems to work??
Warning (512): SQL Error: 1054: Unknown column 'Subcat.cat_id' in
'where clause' [CORE/cake/libs/model/datasources/dbo_source.php, line
525]
Warning (512): SQL Error: 1054: Unknown column 'Cat.
When using pagination with on the fly binds you need to specify the
last parameter as false to make the bind last for multiple queries.
$this->LocalInfo->bindModel(array('belongsTo'=>array(
'Cat'=>array(
'foreignKey'=>false,
'type'=>'INNER',
'conditions'=>array('Subcat.cat_id = Cat.i
I just tried using Containable:
$this->LocalInfo->Behaviors->attach('Containable');
$this->paginate['LocalInfo'] = array(
'contain' => array('Subcat', 'Cat', 'Location'),
'order' => 'LocalInfo.title'
);
but got these errors:
Warning (512): Model "LocalInfo
Paul,
I was just trying your bindModel trick on the index function of the
same controller, but this one uses the Paginator component to make it
easier for the user to sort through results. However doing this the
bind doesn't seem to be taking place as I am getting SQL errors. Any
suggestions?
War
Paul, sorry for the late reply, I wasn't notified of your response.
Your trick worked like a charm, thanks man, I've been scratching my
head over this for ages. So it's not just me going crazy then, I am
having problems in a few places getting ORM to return my results, as I
am newish to Cake I kept
Now people keep telling me that I am wrong here, but I have always had
problems with deep belongsTo associations not being fetched with
recursive alone.
In your instance LocalInfo belongsTo Subcat which belongsTo Cat which
belongsTo Location and your find recursive stops after the first
belongsTo
Hi, can someone explain what basic fundamental of ORM I am missing? I
am having trouble getting Cake to return the data I am after from
Associated models even though I am pretty sure I have my associations
set correctly:
Location
hasMany -> Cat
Cat:
belongsTo -> Location
hasMany -> Subcat
Subcat
11 matches
Mail list logo