Bonsoir,
Dans mon template show, j'essaye d'afficher le résultat de ma jointure et je n'affiche qu'un résultat ! Pourtant dans la barre de débug, la requette MySQL retourne bien plusieurs résultats dans PHPmyAdmin 
Mon shema:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
| ForumMessage:
connection: doctrine
tableName: forum_message
columns:
id:
type: integer(4)
fixed: false
unsigned: false
primary: true
autoincrement: true
id_subject:
type: integer(4)
fixed: false
unsigned: false
primary: false
notnull: false
autoincrement: false
message:
type: string()
fixed: false
unsigned: false
primary: false
notnull: false
autoincrement: false
date:
type: timestamp(25)
fixed: false
unsigned: false
primary: false
notnull: false
autoincrement: false
ForumSubject:
connection: doctrine
tableName: forum_subject
columns:
id:
type: integer(4)
fixed: false
unsigned: false
primary: true
autoincrement: true
title:
type: string(255)
fixed: false
unsigned: false
primary: false
notnull: false
autoincrement: false
author:
type: string(45)
fixed: false
unsigned: false
primary: false
notnull: false
autoincrement: false
hit:
type: integer(4)
fixed: false
unsigned: false
primary: false
default: '0'
notnull: false
autoincrement: false
date:
type: timestamp(25)
fixed: false
unsigned: false
primary: false
notnull: false
autoincrement: false
numb_response:
type: integer(4)
fixed: false
unsigned: false
primary: false
default: '0'
notnull: false
autoincrement: false
slug_title:
type: string(45)
fixed: false
unsigned: false
primary: false
notnull: false
autoincrement: false
online:
type: integer(4)
fixed: false
unsigned: false
primary: false
default: '0'
notnull: false
autoincrement: false
relations:
ForumMessage:
local: id
foreign: id_subject
type: many |
Dans mon action Show je fais :
$this->messages = Doctrine::getTable('ForumSubject')->getAllMessages($request->getParameter('id'));
et dans mon template par exemple
1 2 3 4
| <?php foreach ($messages as $message): ?>
...<td><?php echo $message->getAuthor() ?></td>
...<td><?php echo $message->getMessage() ?></td>
<?php endforeach; ?> |
et j'ai bien "Author" & "Message" qui sont 2 colonnes dans mes 2 tables respectives preuvent que la liaison fonctionne ! Mais au lieu d'afficher 2 résultats, j'en ai qu'un.
J'ai essayé
$this->messages = Doctrine::getTable('ForumSubject')->find(array($request->getParameter('id')));
et là, j'ai l'erreur
Call to a member function getId() on a non-object
Alors je sais plus quoi faire pour afficher mes 2 lignes !
Merci d'avance
Partager