Hey,

I defined a "user" (named Gebruiker in my native language ) model
where when I call a $this->find() , needs to retrieve only a limited
amount of related information.

When I add the 'limit' => '10' to the association info, it doesn't
work. For example: I call
   $gebruiker = $this->find(
        array("Gebruiker.id" => $gebruikerid)
    );
 in the model and it retrieves 11 'kommentaars'.

Does anyone know why this happens? I searched the internet for model
information, and even the example on
http://manual.cakephp.org/chapter/models show the same way of doing
this. But it works in their example and not in my situation ;)

Does anyone know how to solve this problem?

Thanks,

Here's the code:

class Gebruiker extends AppModel
{
        var $name = 'Gebruiker';

                var $hasMany = array(
                'Blog' => array(
                    'className'     => 'Blog',
                                'order' => 'Blog.created DESC',
                                'limit' => '10',
                                'foreignKey' => 'gebruiker_id',


                        ),
                        'Kommentaar' => array(
                                'className'     => 'Kommentaar',
                                'order' => 'Kommentaar.created DESC',
                                'limit' => '5',
                                'foreignKey' => 'gebruiker_id'
                        ),
                        'Message_sent' => array(
                                'className' => 'Message',
                                'order'    => 'Message_sent.created DESC',
                                'limit'        => '10',
                                'foreignKey'    => 'sender_id',
                        ),
                        'Message_received' => array(
                                'className' => 'Message',
                                'order'    =>
'Message_received.created DESC',
                                'limit'   => '10',
                                'foreignKey'    => 'receiver_id',
                        )
                );
 <!-- Model logic here -->
}

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