I write an address organization program for my SO and myself. So I have a lot
of adresses which belong to at least one user.
Very simple: I have a HABTM connection between users and adresses. When I use
'find' it works as it should, but I have problems when using the 'paginate'
function.
When I search I get the following error:
SQL Error: 1054: Unknown column 'AdressensUser.user_id' in 'where clause'
which is no wonder since cake doas not join my connection table.
What I found on the web relates to cake 1.1 or 1.2 and I would like to know if
anybody has solved the problem in cake 1.3
My code in detail:
in the adressens_controller I have the function 'search' after putting
together my search parameters $param they result in the follwing array:
$param
Array
(
[Adressen.vorname LIKE] => %Anja%
[or] => Array
(
[0] => Array
(
[AdressensUser.user_id] => 1
)
[1] => Array
(
[AdressensUser.user_id] => 2
)
)
)
( This should give me all adresses which belong to either of those users)
$paginator_params = array(-
'controller' => 'adressens',
'action' => $this->action,
'pass'
);
$this->paginate['Adressen'] = array(
'limit' => 10,
'order' => array ('Adressen.nachname' => 'asc'),
'url' => $paginator_params
);
//here I get the data and the error
$adressens = $this->paginate('Adressen',$param);
Should I have the serach function in the users controller instead? Is there a
tutorial somewhere out there which is valid for 1.3?
Thanks in advance for any help and hints
Anja
--
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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment