Thursday, August 23, 2012

How to retrieve this kind of data?

I'm trying to obtain the list of users assigned to the "listing" model to use this as selected values for checkboxes in edit form.

The code below obtains a list of users, but its giving me all the users and i want only the selected ones. The condition in listing model makes the listing that is not the same as the one i am editing not to be returned, but the user is still being returned.

            $selected = $this->Listing->User->find('all', array(
                'recursive' => 1,
                'contain' => array(
                    'Listing' => array(
                        'conditions' => array(
                            'Listing.id' => $id
                        )
                    )
                ),
                'conditions' => array(
                )
            ));

thanks in advance

--
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+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
 
 

No comments: