Hey thanks : )

I've tried this but seems like CakePHP doesn't parse the condition
correctly:


        var $belongsTo = array(
                        'Wdevice' => array(
                                                                'className' => 
'Wdevice',
                                                                'foreignKey' => 
false,
                                                                'conditions' => 
array('Wdevice.device_mac' =>
'Radpostauth.username')

                        )
        );

SELECT `Radpostauth`.`id`, `Radpostauth`.`username`,
`Radpostauth`.`pass`, `Radpostauth`.`reply`, `Radpostauth`.`authdate`,
`Wdevice`.`id`, `Wdevice`.`wcontract_id`, `Wdevice`.`device_mac`,
`Wdevice`.`wdevices_model_id`, `Wdevice`.`created`,
`Wdevice`.`modified` FROM `radpostauth` AS `Radpostauth` LEFT JOIN
`wdevices` AS `Wdevice` ON (`Wdevice`.`device_mac` =
'Radpostauth.username') WHERE 1 = 1 ORDER BY `Radpostauth`.`id` desc
LIMIT 50

It fails on:

ON (`Wdevice`.`device_mac` = 'Radpostauth.username')

must be:

ON (`Wdevice`.`device_mac` = `Radpostauth`.`username`)

Because if not SQL will try to match `Wdevice`.`device_mac` against
string "Radpostauth.username" and it don't work.

I've tried to change it but i can't make it work

Thanks for your help


On 1 ene, 08:42, Geoff Douglas <drdouglas...@gmail.com> wrote:
> BelongsTo is simply a left join, (on the retrieval side)...
>
> I think what you are looking for is the Relationship conditions option.
> (Which will create the ON statement in SQL)
>
> So what you want is something that looks like...
>
> Radpostauth Model...
>
> var $belongsTo = array(
>
> 'Wdevice' => array(
>
> 'className' => 'Wdevice',
>
> 'foreignKey' => false,
>
> 'conditions' => array(
>
>  Wdevice.device_mac = radpostauth.username
>
> )
>
> )
>
> );

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to