Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Symfony]jeden do wielu, klucze obce, one to many foreign key
kamil.deb
post
Post #1





Grupa: Zarejestrowani
Postów: 22
Pomógł: 1
Dołączył: 13.06.2009

Ostrzeżenie: (0%)
-----


Witam

Mam problem z wywołaniem rekordów w symfony

Moja schema:

CODE

quiz_questions:
id: {type: integer}
question: {type: varchar(100), required: true}
answer_id: {type: integer, required: true, foreignTable: quiz_answers, foreignReference: id}
quiz_answers:
id: {type: integer}
answer: {type: varchar(100), required: true}


akcja:

  1.  
  2. <?php
  3.  
  4. class quizComponents extends sfComponents
  5. {
  6. public function executeQuestions()
  7. {
  8. $this->questions = QuizQuestionsPeer::doSelectJoinAll(new Criteria());
  9.  
  10. }
  11. }
  12. ?>


i widok

  1. <?php foreach ($questions as $question): ?>
  2. <h4><?php echo $question->getQuestion() ?></h4>
  3. <?php foreach ($question->getQuizAnswers() as $answers): ?>
  4. <input type="radio" name="some_name" value="" id="some_name">
  5. <label for="some_name"><?php echo $answers->getAnswer() ?></label>
  6. <?php endforeach ?>
  7.  
  8. <?php endforeach ?>


Otóż nie wiem jak zapętlic żeby otrzymać wszystkie odpowiedzi.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 07:15