如果表是空的,如何显示'No Record found'?

I am new in cakephp 3. Now, I am fetching data from database which is successfully show all table data but I want to show 'No record found' message if table is empty. So, How can I do this ?Please help me.

Controller: PostsController

<?php
    namespace App\Controller;
    use App\Controller\AppController;

    Class PostsController extends AppController {
        Public function index(){
            $this->set('data',$this->Posts->find('all'));
        }
    }
?>

Layout: Index.cpt

<div class="row">
    <table class="table">
        <thead>
            <tr>
                <th>Title</th>
                <th>Description</th>
                <th>Action</th>
            </tr>
        </thead>
        <tbody>
            <?php
                if(!empty($data))
                {
                    foreach($data as $row)
                    {
            ?>
                        <tr>
                            <td><?php echo $row->title; ?></td>
                            <td><?php echo $row->description; ?></td>
                            <td></td>
                        </tr>
            <?php
                    }
                }
                else
                {
                    echo '<p>No record found</p>'; 
                }
            ?>
        </tbody>
    </table>
</div>

As find('all') method in cakephp return object, it wont be empty if check normally.

Instead of

if(!empty($data))

Try this line

if (!$data->isEmpty()) {

Should work.

Please find updated documentation link.