Q:

cakephp order by ID

I have a small CakePHP app in which I retrieve some client information in a table. In the main table where all my clients show up I would like to sort them by ID (highest ID on top)
My current code is as follows:
    <?php foreach($clients as $client) : ?>
    <tr>
        <td><?php echo $client['Client']['id']?></td>
        <td><?php echo $this->Html->link($client['Client']['client_name'], array('action' => 'view', $client['Client']['id']), array('class' => 'view')); ?></td>
        <td><?php echo $client['Client']['client_contact']?></td>
        <td><a href="tel:<?php echo $client['Client']['client_phone']?>"><?php echo $client['Client']['client_phone']?></a></td>
        <td><a href="mailto:<?php echo $client['Client']['client_email']?>"><?php echo $client['Client']['client_email']?></a></td>
    </tr>
    <?php endforeach; ?>

How can I implement the related sort-order here? Some expert help would be greatly appreciated, thank you

A:

you can use order in your find function.Like below code
$this->Client->find('all', array(
    'order' => array('Client.id' => 'desc')
));

