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 [email protected]
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