cakePhp3を使ってwebアプリ作成をしています。
php
1 2 $routes->connect( 3 '/:entity_name', 4 ['controller' => 'Data', 'action' => 'index', '_method' => 'GET'] 5 ); 6
このようなルーティングで、このentity_nameによってDBのテーブルを動的に変更してモデルを利用し、そのモデルの一覧を表示しています。
(セキュリティ的に問題がないようentity_nameに使える語は制限しています)
更に以下のようにページネーションオプションをつけ、
php
1 2<? $this->Paginator->options( ["controller" => "Data", 3 "action" => "index_csv", 4 urlencode($entity_name)])?> 5
getSchema()->columns()を利用し動的にカラム名を取得し、$columnsに入れた後ページネーションを生み出そうとしたのですが、
php
1 2 <?foreach ($columns as $column): ?> 3 <th scope="col"><?= $this->Paginator->sort($column) ?></th> 4 <?endforeach;?>
None of the currently connected routes match the provided parameters. Add a matching route to config/routes.php The passed context was: [ '_base' => '', '_port' => '80', '_scheme' => 'http', '_host' => 'localhost', 'params' => [ 'entity_name' => 'NFCポート', 'pass' => [], 'controller' => 'Data', 'action' => 'index', '_method' => 'GET', 'plugin' => null, '_matchedRoute' => '/:entity_name', 'isAjax' => false, 'paging' => [ 'Data' => [ [maximum depth reached] ] ] ] ]
このようなエラーがでました。ルーティングミスらしいのですが、machedRouteがあっていて、なにをやってもエラーになるので混乱しています。
どのようにすればページネーションできるでしょうか。
よろしくお願いします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。