Ich habe Fragen Tabelle, die Speicher so viele Fragen haben. Frage, die sich auf Fragetopics bezieht, also create hat viele Beziehung mit Frage. Jetzt ist es so aussehen:hasMany Bedingung zeigen unerwünschte Aufzeichnungen cakephep 1.3
$this->Question->bindModel(
array(
'hasMany' => array(
'QuestionTopic'=>array(
'className' => 'QuestionTopic',
'foreignKey' => 'question_id',
'dependent' => true,
'conditions' => array('QuestionTopic.areas_id' => 165),
'type' => 'left'
)
)
)
);
print_r($this->Question->find('all'));
die;
Wenn ich das Ergebnis sah dann es aussehen wie dieses
Array
(
[0] => Array
(
[Question] => Array
(
[id] => 89
[user_id] => 1
[question_group_id] => 0
[question] => jQuery function here
[target_id] => 1
[type] => 1
[order] => 1
[description] => additional info here
[privacy_friend_id] =>
[channel_id] => 1
[status] => 0
[location] => Chandigarh, India
[regions] => 307
[select_country] => 381
[select_states] => 515
[created] => 2014-04-15 06:59:44
[modified] => 2014-04-15 06:59:44
)
[QuestionTopic] => Array
(
[0] => Array
(
[id] => 167
[areas_id] => 165
[question_id] => 89
)
)
)
[1] => Array
(
[Question] => Array
(
[id] => 90
[user_id] => 1
[question_group_id] => 0
[question] => Art
[target_id] => 2
[type] => 1
[order] => 1
[description] => addional infomation here
[privacy_friend_id] =>
[channel_id] => 1
[status] => 0
[location] => Chandigarh, India
[regions] => 307
[select_country] => 381
[select_states] => 515
[created] => 2014-04-15 07:52:17
[modified] => 2014-04-15 07:52:17
)
[QuestionTopic] => Array
(
)
)
)
ich zum ersten Mal aufnehmen möchten, die nur Frage Thema ID 167 nicht zweiten. Wie kann ich das machen.
falsch Jean wird es nicht funktionieren .. –
Bitte hasOne, dies zu tun – Harman