Hello, I am moving to cake 5.1 and receive Paginator Error in the template inthe header tags.
My Controller function:
public function index($id = null) {
$query = $this->News->find();
$news = $this->paginate($query, [
'scope' => 'news'
]);
$this->set(compact('news'));
$this->render('/Homepage/News/index');
}
Error: TypeError: Cake\View\View::get(): Argument #1 ($var) must be of type string, int given
called in PaginatorHelper.php on line 142
Template
<?php
/**
* @var \\App\\View\\AppView $this
* @var iterable<\\App\\Model\\Entity\\Article> $articles
*/
$yesno = $this->get('appYesNo');
$appnews = $this->get('appNews');
?>
<?= $this->Element('navigation', ['navi' => $prodItem]); ?>
<div class="news index content">
<?= $this->Html->link(__('Neue Neuigkeit'), ['action' => 'add'], ['class' => 'button float-right']) ?>
<h3><?= __('Neuigkeiten') ?></h3>
<div class="table-responsive">
<table>
<thead>
<tr>
<th width="40"><?= $this->Paginator->sort('id') ?></th>
<th width="300"><?= $this->Paginator->sort('title') ?></th>
<th><?= $this->Paginator->sort('type') ?></th>
<th><?= $this->Paginator->sort('folder') ?></th>
<th><?= $this->Paginator->sort('active') ?></th>
<th><?= $this->Paginator->sort('login') ?></th>
<th width="200" class="actions"><?= __('Actions') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($news as $news): ?>
<tr>
<td><?= h($news->title) ?></td>
<td>
<?php
echo $appnews[$news->type];
?>
</td>
<td><?= h($news->folder) ?></td>
<td>
<?php
echo $yesno[$news->active];
?>
</td>
<td>
<?php
echo $yesno[$news->login];
?>
</td>
<?= $this->Element('viewArticleAction', array('recCon' => 'News', 'action' => 'singleNews', 'recId' => $news->id, 'parentId' => $news->id)); ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div class="paginator">
<ul class="pagination">
<?= $this->Paginator->first('<< ' . __('first')) ?>
<?= $this->Paginator->prev('< ' . __('previous')) ?>
<?= $this->Paginator->numbers() ?>
<?= $this->Paginator->next(__('next') . ' >') ?>
<?= $this->Paginator->last(__('last') . ' >>') ?>
</ul>
<p><?= $this->Paginator->counter(__('Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')) ?></p>
</div>
</div>
Whats the problem? Kid regards Klaus