Hi,
I'm having problem with fieldnames from associated models in
findAll(). I saw it quite common for others.
The result from $this->Realization->findAll() - as below - shows that
associations works ok, BUT when try to condition on Photo it is wrong
e.g. $this->Realization->findAll('Photo.id = 59') cause "SQL Error:
1054: Unknown column 'Photo.id' in 'where clause'"
[0] => Array
(
[Realization] => Array
(
[id] => 1
[title] => liceum_sztuk_plastycznych
)
[Photo] => Array
(
[0] => Array
(
[id] => 59
[realization_id] => 1
)
[1] => Array
(
[id] => 58
[realization_id] => 1
)
What is strange $this->Realization->Photo->findAll('Photo.id = 59')
will work ok.
It is strictly connected with :
http://groups.google.pl/group/cake-php/browse_thread/thread/dcbb867063e4696c/4fbbbd0bf6223330?tvc=2&q=findAll#4fbbbd0bf6223330
My models code :
Ralization.php
<?php
class Realization extends AppModel {
var $name="Realization";
var $hasMany = array('Photo');
}
?>
and
Photo.php
<?php
class Photo extends AppModel {
var $name="Photo";
var $belongsTo = 'Realization';
}
?>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---