Hi All;

I have two models Destination and SubDestination as follows:

Table: destinations, Column: id, destination, topic

class Destination extends AppModel
{
    var $name = 'Destination';

    var $hasMany = array('SubDestination' =>
                         array('className'     => 'SubDestination',
                               'conditions'    => '',
                               'order'         => '',
                               'limit'         => '',
                               'foreignKey'    => 'sub_id',
                               'dependent'     => true,
                               'exclusive'     => false,
                               'finderQuery'   => ''
                         )
                  );

}
and

Table: sub_destinations, Column: sub_id,id, destin, topic

class SubDestination extends AppModel
{
    var $name = 'SubDestination';
    var $belongsTo = array('Destination' =>
        array('className'  => 'Destination',
        'conditions' => '',
        'order'      => '',
        'foreignKey' => 'sub_id'
        )
     );


}


Note: I added blongsTo only trying to solve the problem.

The problem is when I use $this->Destination->findAll($conditions) where

$conditions=array ("Destination.destination" => "like '%manage%'","or" =>
array("SubDestination.destin" => "like '%manage%'"));

I recieve an error message: "SQL Error in model Post: 1054: Unknown column '
SubDestination.destin' in 'where clause'"

the sql statement with debug level 3 is SELECT `Destination`.`id`,
`Destination`.`username`, `Destination`.`destination`,
`Destination`.`topic`, `Destination`.`post` FROM `destinations` AS
`Destination` WHERE ((`Destination`.`destination` like '\'%manage%\'') OR
(`SubDestination`.`destin` like '\'%manage%\''))

I also tried the following for condition as helped out by some other guy but
it is also not working.

$conditions=array ("or" => array("Destination.destination" => "like
'%manage%'","SubDestination.destin" => "like '%manage%'"));

Please point the mistake/wrong i m doing.

Thanks.

 Ifti Khan,

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to