récupérer les données d'une jointure: symfony
bonsoir tout le monde,
lors d'une jointure, je n'ai pas pu afficher aucune donnée,
encore je ne sais pas si le problème provient de l'affichage ou bien ma méthode n'a pas pu récupéré les données
si quelqu'un peut m'aider je serai très reconnaissante
//ArticlesTable.class.php
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
static public function getArticleRupture()
{
$q=Doctrine_Query::create()
->select('a.codearticle',
'a.ref',
'a.designationarticle',
'a.designationlongarticle',
'a.stockreel',
'a.minStock',
'a.stocktheorique',
'a.gestionstock',
'a.bloque',
'r.libellerayon')
->from('Articles a')
->leftJoin('a.Rayon r')
->where('r.coderayon = ?', 'a.codearticle')
->andWhere('a.GestionStock=?','1')
->andWhere('a.Stockreel <=?','a.MinStock');
return $q->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
} |
//action.class.php:
Code:
1 2 3 4
| public function executeIndex(sfWebRequest $request)
{
$this->ruptures = ArticlesTable::getArticleRupture();
} |
et pour mon code d'affichage;
// indexSuccess.php:
Code:
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
|
<table>
<caption> Liste des Articles en rupture de stock </caption>
<thead>
<tr>
<th>CodeArticle</th>
<th>Désignation</th>
<th>Désignation Longue </th>
<th>Stock réel</th>
<th>Stock Min</th>
<th>Stock théorique</th>
<th>Géré.Stock</th>
<th>Bloqué</th>
<th>Rayon</th>
</tr>
</thead>
<tbody>
<?php foreach ($ruptures as $rupture)
{
?>
<tr>
<td><?php echo $rupture->getCodeArticle() ?></td>
<td><?php echo $rupture->getREF() ?></td>
<td><?php echo $rupture->getDesignationarticle() ?></td>
<td><?php echo $rupture->getStockreel() ?></td>
<td><?php echo $rupture->getMinStock() ?></td>
<td><?php echo $rupture->getStocktheorique() ?></td>
<td><?php echo $rupture->getGestionStock() ?></td>
<td><?php echo $rupture->getBloque() ?></td>
<td><?php echo $rupture->Rayon()->getLibellerayon() ?></td>
</tr>
<?php
}
?>
</table> |