you're welcome :-)

On 15 jan, 23:29, Santiago Basulto <santiago.basu...@gmail.com> wrote:
> This is exactly what i need!!
>
> Thank you very much brother!
>
> On Jan 15, 7:12 pm, alaxos <ala...@gmail.com> wrote:
>
> > Have you looked at the Containable behavior ? It can call the
> > unbindModel() for you.
>
> >http://book.cakephp.org/view/1323/Containable
>
> > Regards,
> > nIcO
>
> > On 15 jan, 20:56, Santiago Basulto <santiago.basu...@gmail.com> wrote:
>
> > > Hello people. I'm facing a little problem here.
>
> > > Supose i've my Car Model defined like this:
>
> > > class Car extends AppModel{
> > >    $name = 'Car';
>
> > >    // Associations
> > >    $hasOne = array('engine');
>
> > >    $hasMany = array('Tyre','Color','OtherModel', ..... );
>
> > > }
>
> > > I would like to read the data from my Car model but just get the data
> > > for the engine. Not the other associated models (Tyre, Color, etc).
>
> > > Something like this:
>
> > > $this->Car->read(null,$id) =
>
> > > array(
> > >    [Car] = Array(  //car data  )
> > >    [Engine] = Array(// Engine data)
> > > )
>
> > > if i set recursive to -1, i just get the Car data. If it's 1, i get
> > > all the data (Car, Engine, Tyre, etc).
>
> > > I could unbind the models i don't want to read, something like this:
>
> > > $this->Car->unbindMoldel(
> > > array('hasMany'=>array('Tyre','Color','OtherModel')), true).
>
> > > I was wondering if there's a better solution.
>
> > > Also, if i have my model "loaded" in $this->Car, how can i get the
> > > associated models from here?
> > > I mean, if i do this:
>
> > > $this->Car->recursive= -1;
> > > with a call to read() i get the Car data. How can, from here, get the
> > > other associated models?
>
> > > Something like:
> > > $this->Car->Engine->readCurrent ??
>
> > > Thanks!!!!
>
> > > --
> > > Santiago Basulto.-

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

Reply via email to