fix: Fix notice if invalid taxonomy is viewed

pull/2547/head
iglocska 2017-10-05 22:47:36 +02:00
parent bbbdea72e3
commit 1dec3e23e8
1 changed files with 1 additions and 1 deletions

View File

@ -50,11 +50,11 @@ class TaxonomiesController extends AppController {
App::uses('CustomPaginationTool', 'Tools');
$filter = isset($this->passedArgs['filter']) ? $this->passedArgs['filter'] : false;
$taxonomy = $this->Taxonomy->getTaxonomy($id, array('full' => true, 'filter' => $filter));
if (empty($taxonomy)) throw new NotFoundException('Taxonomy not found.');
foreach ($taxonomy['entries'] as $key => $value) {
$taxonomy['entries'][$key]['events'] = count($value['existing_tag']['EventTag']);
}
$this->set('filter', $filter);
if (empty($taxonomy)) throw new NotFoundException('Taxonomy not found.');
$customPagination = new CustomPaginationTool();
$params = $customPagination->createPaginationRules($taxonomy['entries'], $this->passedArgs, 'TaxonomyEntry');
if ($params['sort'] == 'id') $params['sort'] = 'tag';