Hi AD7six,

i apologise if i have asked a question that can be easily answered if
i looked a little more closely.

but i am having some problems.

Here it is:

i tried this

                $this->Behaviors->attach('OneQuery');
                $this->User->Behaviors->attach('OneQuery');
                $this->Shop->Behaviors->attach('OneQuery');
                $this->Shop->Domain->Behaviors->attach('OneQuery');

                debug('test');
                return $this->find('first', array(
                        // linkable behavior in OneQuery
                        'link'=>array(
                                'User',
                                'Shop'=>'Domain',
                        ),
                                // conditions for the main model

                        'conditions'=>array('Merchant.owner'=>1,
                                            'User.group_id'=>MERCHANTS,
                                            'User.email' => 'a...@a.com',
                                            'Shop.web_address' => 
'http://abc.myspree2shop.com',),

                ));

i got this in my query:

SELECT `Merchant`.`id`, `Merchant`.`owner`, `Merchant`.`shop_id`,
`Merchant`.`user_id` FROM `merchants` AS `Merchant` WHERE
`Merchant`.`owner` = 1 AND `User`.`group_id` = 3 AND `User`.`email` =
'a...@a.com' AND `Shop`.`web_address` = 'http://abc.myspree2shop.com'

And this error message
1054: Unknown column 'User.group_id' in 'where clause'

So i tried to change it to look like one of your examples in your
blogpost.

                $this->Behaviors->attach('OneQuery');
                $this->User->Behaviors->attach('OneQuery');
                $this->Shop->Behaviors->attach('OneQuery');
                $this->Shop->Domain->Behaviors->attach('OneQuery');

                debug('test');
                return $this->find('all', array(
                        // linkable behavior in OneQuery
                        'link'=>array(
                                'User',
                                'Shop'=>'Domain',
                        ),


                ));

i get this instead

SELECT `Merchant`.`id`, `Merchant`.`owner`, `Merchant`.`shop_id`,
`Merchant`.`user_id` FROM `merchants` AS `Merchant` WHERE 1 = 1

and the data set ONLY containing Merchant data

Array
(
    [0] => Array
        (
            [Merchant] => Array
                (
                    [id] => 1
                    [owner] => 1
                    [shop_id] => 1
                    [user_id] => 1
                )

        )

    [1] => Array
        (
            [Merchant] => Array
                (
                    [id] => 2
                    [owner] => 1
                    [shop_id] => 2
                    [user_id] => 2
                )

        )

)

 i suspect i must have done something wrong. Please advise.

 Appreciate it greatly.




On May 4, 8:44 pm, AD7six <andydawso...@gmail.com> wrote:
> On May 4, 2:13 pm, sphereweb <ggr...@gmail.com> wrote:
>
> > I would like to see your example that gets the data from 4-5 tables :)
>
> There's only 1 test case in it but you can see usage 
> here:http://github.com/AD7six/mi/blob/master/tests/cases/behaviors/one_que...
>
> Although the single test case is calling oneQuery explicitly - you
> normally use the behavior in exactly the same as containable
> (including you can configure onequery to look for the param name
> "contain") but the result is - one query.
>
> hth,
>
> AD
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> athttp://groups.google.com/group/cake-php?hl=en

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