I don't know if the following behaviour is by design, a bug or I'm
missing something.

I have 3 models T1, T2 and T3 (the tables belong to the same database)

T1 hasOne T2
T1 hasOne T3

$this->T1->find('all', array('conditions'=> array('T3.name' => null)))
gives:

Array
(
    [0] => Array
        (
            [T1] => Array
                (
                    [id] => 1
                    [name] => dog
                )
            [T2] => Array
                (
                    [id] => 1
                    [t1_id] => 1
                    [name] => white
                )
            [T3] => Array
                (
                    [id] =>
                    [t1_id] =>
                    [name] =>
                )
        )
    [1] => Array ...

If I move T3 to another database (I add var $useDbConfig = 'otherdb'
in T3.php and create the table of course) I get:

In the view:

Warning (512): SQL Error: 1054: Unknown column 'T3.name' in 'where
clause' [CORE/cake/libs/model/datasources/dbo_source.php, line 525]
Query: SELECT `T1`.`id`, `T1`.`name`, `T2`.`id`, `T2`.`t1_id`,
`T2`.`name` FROM `t1s` AS `T1` LEFT JOIN `t2s` AS `T2` ON
(`T2`.`t1_id` = `T1`.`id`)  WHERE `T3`.`name` IS NULL
As you can see the join between T1 AND T3 is missing.

find('all') now gives no result.

Is this the expected behaviour? There are limitations when relating
models that belong to different dbs?
I'm using cakephp 1.2.6.

Thank you
   maxx

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to