Now it runs Thanks a lot in that model.

In the other way the Model contained Model1 is empty but why?

Here is the code of my model1

 $this->Model2->Behaviors->attach('Containable');
        $this->set('var1', $this->Model2->find('first',
                array(
                    'conditions' => array('Model2.id' => $id),
                    'contain' => array('Model1' => array('fields'=>
array('Model1.register_password'))),
                        'fields' => array(
                            'Model2.id',
                            'Model1.id',
                            'Model1.register_password',
                            'Model2.id',
                            'Model2.description',
                            )
                    )
                )
                );

The debug output looks so

Array
(
    [WishlistEntry] => Array
        (
            [wishlist_id] => 1
            [id] => 2
            [title] => Text
            [description] => Text
            [reservation_status] => FREE
        )

    [Wishlist] => Array
        (
            [register_password] =>
            [id] =>
        )

)

Whats wrong with it





On 27 Mrz., 12:38, amarradi <radis...@googlemail.com> wrote:
> Hello,
>
> thanks for that idea ands that way, but after i try it, it will be
> shown the hole array of Model2.
> Where are my fault?
>
> Marcus
>
> On 27 Mrz., 06:11, Martin Radosta <martinrado...@gmail.com> wrote:
>
> > |Your question is not clear, I guess you need this:
>
> > $this->Model1->Behaviors->attach('Containable');
> > |
>
> > $this->Model1->find('first',
> >         array(
> >                 'conditions' =>  array('Model1.id' =>  $id),
> >                 'contain' =>  array('Model2' =>  array('fields' =>  
> > array('Model2.title', 'Model2.description', 'Model2.reservation_status'))),
> >                 'fields' =>  
> > array('Model1.id','Model1.title','Model1.description')
> >          )
> > );
>
> > On 03/26/2010 09:10 PM, amarradi wrote:
>
> > > I have to go to bed good night
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > > with their CakePHP related questions.
>
> > > 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+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en
>
> > > To unsubscribe from this group, send email to 
> > > cake-php+unsubscribegooglegroups.com or reply to this email with the 
> > > words "REMOVE ME" as the subject.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to