Mariano had a great approach to unbinding selected associations before
reading data. See: 
http://bakery.cakephp.org/articles/view/an-improvement-to-unbindmodel-on-model-side
Good luck.

V

On Jun 11, 10:08 pm, Jorge Vargas <[EMAIL PROTECTED]> wrote:
> Hi
>
> I'm new to cake but not to app development. I'm confused with the
> following: I got a table structure and assoc. Everything loaded fine
> with the scaffold so relationships are ok. PS: sorry if I break naming
> conventions here they are not in the code.
>
> I got a TakeExamController which has a method call take($id) which
> will display the exam and then another call grade that will store the
> results.
>
> my model has the following Exam hasMany Sections hasMany Questions
> *other stuff
>
> so I want take() to fetch my Exam.name all it's section.name and
> everything under Question. In order to this play it all in the view as
> a normal exam.
>
> now I have accomplish this with the very ugly $this->set('exam',$this-
>
> >Exam->find(null,null,null,3));#$recursive=3
>
> and then I could juggle with that huge set of data in the view but
> that's way way too inefficient.
>
> I have manage to clear all the non-desired fields from all Models with
> the following.
> $fields=array('name')
> $exam=$this->Exam->read($fields);
> or the equivalent find()
> etc.
>
> but what got me lost is how I can fetch one and only one of the assoc
> for example Exam has a relationship with ExamResults but I don't want
> that right now. I just wants all Sections that belong to the current
> exam. how hard can that be? isn't there a way to get just one assoc
> without fetching everything that related to that object from the db?
>
> PS: someone on IRC told me about bind/unbind but that just seems like
> going way to far to get a simple query going


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to