I have 3 models: hosts, offers, problems.

Hosts holds info about companies(e.g. GoDaddy)
Problems holds info about the problems (e.g. I need super host with
100TB/month)
Offers holds info about exact host offer for exact problem (e.g. It
would cost you 69USD), there may be many offers for single problem.

Question:
How to set associations correctly to make it possible to use $this ->
Host -> find (myCondition));?

By now i have

class Host extends AppModel
{
        var $name = 'Host';
        var $hasMany = array ( 'Offer => array ('className' => 'Offer'));
}

class Problem extends AppModel
{
        var $name = 'Problem;
        var $hasMany = array ( 'Offer => array ('className' => 'Offer'));
}

class Supply extends AppModel
{
        var $name = 'Supply';
        var $belongsTo = array('Host'  => array('className' => 'Host'),
                                         'Problem' => array('className' => 
'Problem') );
}


as i call  $this -> Host -> find (myCondition));
I EXPECT to get something like

Array
(
    [Host] => Array
        (
            [id] => 69
            [name] =>GoDaay
        )
    [Offer] => Array
        (
            [0] => Array
                (
                    [id] => 2
                    [name] => We can for 69USD
                [host_id] => 69
                [problem_id] =>69
                    [Problem] => Array
                        (
                            [id] => 69
                            [name] => I need host
                            )
                        )

            [1] => Array
                (
                    [id] => 3
                    [name] => We can for 3USD
                    [host_id] => 69
                    [problem_id] =>696
                    [Problem] => Array
                        (
                            [id] => 696
                            [name] => I need cheep host
                            )
                        )
                )
        )
)

but I GET

Array
(
    [Host] => Array
        (
            [id] => 69
            [name] =>GoDaay
        )
    [Offer] => Array
        (
            [0] => Array
                (
                    [id] => 2
                    [name] => We can for 69USD
                    [host_id] => 69
                    [problem_id] =>69
                    [Problem] => Array
                        (
                            [id] => 69
                            [name] => I need host
                            [Offer] => array (
                                      [Problem] => problem again
                            )
                        )

            [1] => Array
                (
                    [id] => 3
                    [name] => We can for 3USD
                    [host_id] => 69
                    [problem_id] =>696
                    [Problem] => Array
                        (
                            [id] => 696
                            [name] => I need cheep host
                            [Offer] => array (
                                       [Problem] => problem again
                                  )
                            )
                        )
                )
        )
)



--~--~---------~--~----~------------~-------~--~----~
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