How to display data in a view cakephp3

I have loaded a query in a pagination and how do i display the data in a view in cakephp3?
In cakephp2 this was dead easy. In the docs I cant find how to display data from associated tables ?
None of this works but the data exists

        <?php foreach ($lessons as $bookmark): ?>
           // debug( $bookmark);
            <td><?php echo $bookmark['Lesson']['id'] ?></td>
            <td><?= h($bookmark->Lessons->id) ?></td>
            <td><?= h($bookmark->lesson_date) ?></td>
            <td><?= h($bookmark->Tutor.first_name) ?></td>
             <td><?= h($bookmark->Tutor.last_name) ?></td>
              <td><?= h($bookmark-> ?></td>
        <?php endforeach; ?>

Hi your code is wrong you must code exaclly like $bookmark->Tutor->first_name.

Still isnt working and i debugged the data on the view below.
This was so easy in cakephp2

Notice (8): Trying to get property of non-object

<?= h($bookmark->Lessons->id) ?>
    <?= h($bookmark->Lesson->lesson_date) ?>
        <?= h($bookmark->Tutor->first_name) ?>
        <?= h($bookmark->Tutor->last_name) ?>
        <?= h($bookmark->Subject->name) ?>

object(App\Model\Entity\Lesson) {

'tutoring_type_id' => (int) 1,
'students' => [
	'id' => '75',
	'first_name' => 'Jes',
	'last_name' => 'ett'

'lessons' => [
	'id' => '5399',
	'lesson_date' => '2015-07-09'
'tutors' => [
	'id' => '12',
	'first_name' => 'Andrew',
	'last_name' => 'Toy'
'subjects' => [
	'id' => '16',
	'name' => 'Maths: Year 7 - 10'

you are must convert above code to tutors.just this

<?= h($bookmark->tutors->first_name) ?> didnt work

where is this in the docs as I only see a basic example only?

yes there are a lot of example.I don’t why you have problem that is very simple.

SO what do i do as i got rid of the pagination to make it simpler

    $this->set('_serialize', ['query3']);


<?php foreach ($query3 as $bookmark): ?>
         // debug( $bookmark);
            <td><?= h($bookmark->lessons->id) ?></td>
            <td><?= h($bookmark->lessons->lesson_date) ?></td>
            <td><?= h($bookmark->tutors->first_name) ?></td>
             <td><?= h($bookmark->tutors->last_name) ?></td>
        <?php endforeach; ?>

I can solve the problem but I dont get why I need to have model names in the select with lower case names and I dont get why these are not objects

           <td><?= $bookmark->lessons['id'] ?></td>
            <td><?= $bookmark->lessons['lesson_date'] ?></td>
            <td><?= $bookmark->tutors['first_name'] ?></td>
             <td><?= $bookmark->tutors['last_name'] ?></td>
             <td><?= $bookmark->subjects['name'] ?></td>
               <td><?= $bookmark->TutoringTypes['value'] ?></td>

well i guess, your Lesson variable includes these arrays and the names of these arrays are all in lower case. and you are trying to fetch data from those arrays so you have to give exact same name as it is given in that lesson array’s data… try analyzing your debug code once more you’ll then get to knw what m talking about. :slight_smile: