Thursday, August 8, 2013

RE: question about recursive

Category model assuming Category hasMany Type :

 

public $hasMany = array(

        'Type' => array(

            'className' => 'Type',

            'order' => 'Type.order ASC'              //DESC depending on how you want them ordered

        )

    );

 

 

Check the section on linking models together with all the various options.

http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html

 

Dave

 

From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of ????? ??????????
Sent: Thursday, August 08, 2013 3:01 PM
To: cake-php@googlegroups.com
Subject: question about recursive

 

I'm new with cake php, but i have a problem that i can't fix...

 

Can i somehow sort data that gets by this attribute?

i'm getting that array

array(
        (int) 0 => array(
               'Category' => array(
                       'id' => '3',
                       'name' => 'Материал',
                       'order' => '1'
               ),
                'Type' => array(
                       (int) 0 => array(
                               'id' => '4',
                               'categorie_id' => '3',
                               'name' => 'дерево',
                               'order' => '3'
                       ),
                       (int) 1 => array(
                               'id' => '5',
                               'categorie_id' => '3',
                               'name' => 'пвх',
                               'order' => '2'
                       ),
                       (int) 2 => array(
                               'id' => '6',
                               'categorie_id' => '3',
                               'name' => 'шпон',
                               'order' => '1'
                       )
               )
        ),
        (int) 1 => array(
               'Category' => array(
                                              .....
so the question is - can i sort 'Type' array by the field 'order'?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate