I'm working on a survey app:
Models Survey, Question, ResponseOption, Response, QuestionResponse
One side is that Survey has several Questions, and Question may have several
ResponseOptions (these are multichoice or a number of check boxes)
These other side is that a Survey has many Responses, and a Response has
many QuestionResponses (which are for a question, and optionally for a
ResponseOption).
In my Survey Controller I'm doing the following to only read the Survey
Side:
$this->Survey->recursive = 2;
$this->Survey->unbindModel(array('hasMany' => array('Response')));
$this->Survey->Question->unbindModel(array('belongsTo' => array('Survey')));
$this->Survey->Question->unbindModel(array('hasMany' =>
array('QuestionResponse')));
$this->Survey->Question->ResponseOption->unbindModel(array('hasMany' =>
array('QuestionResponse')));
$survey = $this->Survey->read(null, $id);
Is there a better way to do this?
If I want to also (in the same method) read the one response and it's
associated QuestionResponses should I just unbind the associations from
$this->Survey->Response?
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