in your Property model $hasMany add: var $hasMany = array('Picture' => array('className' => 'Picture', 'foreignKey' => 'property_id'), 'fields' => array('id', 'name'), );
replacing 'id', and 'name' with whatever you would like returned. As a note - its generally a bad idea to store photos in a database. Just store their filename and location. Hope that helps. On Dec 13, 5:04 pm, Miguel XT <[EMAIL PROTECTED]> wrote: > Hi, > > Let's say I have two models Property and Picture. One Property can > have many Pictures. So I make two models like this: > > class Property extends AppModel { > var $name = "Property"; > > var $hasMany = array('Picture' => > array('className' => 'Picture', > 'foreignKey' => 'property_id') > ); > > } > > class Picture extends AppModel { > var $name = "Picture"; > > var $belongsTo = array('Property' => > array('className' => 'Property', > 'conditions' => '', > 'order' => '', > 'foreignKey' => 'property_id' > ) > ); > > } > > Now I want to use $this->Property->findAll with some conditions and > return ALL the Property model, but NOT ALL the picture Model. That is > because the Picture model have large image data that I don't need. I > just need the picture ID returned. > > What is the best way to accomplish this? > > Regards --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---