Bonjour,
Ce que je fais
DataModel:
public $useTable = 'data'; public $belongsTo = array('Account' => array('classeName' => 'Account', 'foreignKey' => 'compte'));
DataController:
$accounts = $this->Account->find('all', array('order'=>array('name'=>'asc'), 'conditions'=>array('etat' => '1')));
Data.index.ctp
<div class="container">around <h3>BG-Money > Grand-Livre > Résumé</h3>aroundaround <table class="table table-condensed">around <tr>around <th>Désignation du compte</th>around <th>Type de compte</th>around <th>N° de compte</th>around <th>Solde</th>around <th>Nombre d'opérations</th>around </tr>around <?php foreach ($accounts as $cpt): ?>aroundaround <tr>around <td><?php echo $cpt['Account']['name']; ?></td>around <td><?php echo $cpt['Account']['type']; ?></td>around <td><?php echo $cpt['Account']['numero']; ?></td>around <td>Solde</td>around <td></td>around </tr>around <?php endforeach; ?>around </table>around</div>
Ce que je veux
ce que je cherche à faire :
j'ai une table "Account" et une table "Data"
ce que je cherche c'est de compter toute les ligne Data par Account :
Ce que j'obtiens
Je ne sais pas comment faire pour compter les ecriture de "Data" par "Account"