I'm new in cakephp 3.5. I just recently read the same question and I use those solutions. The problem is I tried the solution answered in the past question but it didn't display the needed attributes.
view.ctp (client_transaction)
<div class="related">
<?php if (!empty($clientTransaction->service_detail)): ?>
<table cellpadding="0" cellspacing="0">
<tr>
<th scope="col"><?= __('Service Detail ID') ?></th>
<th scope="col"><?= __('Barber') ?></th>
<th scope="col"><?= __('Service') ?></th>
<th scope="col"><?= __('Price') ?></th>
<th scope="col" class="actions"><?= __('Actions') ?></th>
</tr>
<!--pre>
<?php print_r($clientTransaction->service_detail); ?>
</pre-->
<?php foreach ($clientTransaction->service_detail as $serviceDetail): ?>
<tr>
<td><?= $this->Number->format($serviceDetail->id) ?></td>
<!-- the first solution-->
<td><?= h($serviceDetail->users->first_name)?></td>
<!-- the second solution-->
<td><?= h($serviceDetail->service->name) ?></td>
<td><?= h($serviceDetail->service->price) ?></td>
<td class="actions">
<?= $this->Form->postLink(__('Cancel'), ['controller' => 'ServiceDetail','action' => 'delete', $serviceDetail->id], ['confirm' => __('Are you sure you want to cancel # {0}?', $serviceDetail->id)]) ?>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
</div>
I'm just asking for help. I'm also trying to figure it out. Thank you!
P.S: I just edited the code and the screenshot so that you'll get understand of the problem. thanks!