I am using tree
behaviour for cakephp 3 and baked model, controller, template through CLI it produced the listing for categories
i have followed the table structure and data insertion is also exactly what i need. But in template view i have this code.
<?php foreach ($categories as $category): ?>
<tr>
<td><?php pr($category);?></td>
<td><?= $this->Number->format($category->id) ?></td>
<td><?= $category->has('parent_category') ? $this->Html->link($category->parent_category->name, ['controller' => 'Categories', 'action' => 'view', $category->parent_category->id]) : '' ?></td>
<td><?= h($category->name) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['action' => 'view', $category->id]) ?>
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $category->id]) ?>
<?= $this->Form->postLink(__('Delete'), ['action' => 'delete', $category->id], ['confirm' => __('Are you sure you want to delete # {0}?', $category->id)]) ?>
</td>
</tr>
<?php endforeach; ?>
This $category->has('parent_category')
condition is showing blank it supposed to show parent category name i guess. Please let me know if anyone else has faced same problem. Any pointers to the docs will or anything will be highly appreciated. I have already gone though the official docs it didn't helped.