I'm having some issues with the output of relational models nesting
the arrays incorrectly. Does anyone know if there is a fix for this?
I'm running version 1.1.15.5144.

The problem occurs when I have 3 models, related to each other. With
the first having a belongsTo relationship to the 2nd, and the 2nd
having a belongsTo relationship to the third. I have tried with and
without the hasMany relationships configured. My models are configured
as follows:

class SolutionVertical extends AppModel {
        var $name = 'SolutionVertical';
}

class SolutionCategory extends AppModel {
        var $name = 'SolutionCategory';
        var $belongsTo = array(
                'SolutionVertical' => array(
                        'className'  => 'SolutionVertical',
                        'conditions' => '',
                        'order'      => '',
                        'foreignKey' => 'vertical_id'
                )
        );
}

class SolutionProcess extends AppModel {
        var $name = 'SolutionProcess';
        var $belongsTo = array(
                'SolutionCategory' => array(
                        'className'  => 'SolutionCategory',
                        'conditions' => '',
                        'order'      => '',
                        'foreignKey' => 'category_id'
                )
        );
}

When I output $this->SolutionProcess->findAll(NULL, NULL,
"SolutionProcess.name ASC", 2, NULL, 2) I get the following (limited
to 2 records):

Array
(
    [0] => Array
        (
            [SolutionProcess] => Array
                (
                    [id] => 16
                    [category_id] => 3
                    [name] => Account Management
                    [created] => 0000-00-00 00:00:00
                    [modified] => 0000-00-00 00:00:00
                )

            [SolutionCategory] => Array
                (
                    [id] => 3
                    [vertical_id] => 1
                    [name] => Insurance Applications
                    [created] => 0000-00-00 00:00:00
                    [modified] => 0000-00-00 00:00:00
                    [SolutionVertical] => Array
                        (
                            [id] => 1
                            [name] => Financial Services
                            [created] => 0000-00-00 00:00:00
                            [modified] => 0000-00-00 00:00:00
                        )

                )

        )

    [1] => Array
        (
            [SolutionProcess] => Array
                (
                    [id] => 4
                    [category_id] => 1
                    [name] => Asset Financing
                    [created] => 0000-00-00 00:00:00
                    [modified] => 0000-00-00 00:00:00
                )

            [SolutionCategory] => Array
                (
                    [id] => 1
                    [vertical_id] => 1
                    [name] => Lending Applications
                    [created] => 0000-00-00 00:00:00
                    [modified] => 0000-00-00 00:00:00
                    [SolutionVertical] => Array
                        (
                            [id] => 1
                            [name] => Financial Services
                            [created] => 0000-00-00 00:00:00
                            [modified] => 0000-00-00 00:00:00
                        )

                )

        )

)


Now surely, either the SolutionVertical data should be stored at the
same level as the SolutionCategory and SolutionProcess arrays (so
SolutionVertical, SolutionCategory and SolutionProcess arrays all sit
at the same level). Or the SolutionCategory array should be nested
within the SolutionProcess array (like the SolutionVertical array is
nested within the SolutionCategory).

This is causing me a big headache - mainly because its inconsistant.
Any ideas if there is a solution to this? If its supposed to be like
this?

Thanks in advance.

Dan


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
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