Skip to content

Commit

Permalink
EZP-31935: Fixed TypeError error occuring while Section filter in Sea…
Browse files Browse the repository at this point in the history
…rch is used (#1528)
  • Loading branch information
adamwojs authored Sep 23, 2020
1 parent 6c6311a commit 3f171cb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/View/Filter/AdminSearchViewFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace EzSystems\EzPlatformAdminUi\View\Filter;

use eZ\Publish\API\Repository\ContentTypeService;
use eZ\Publish\API\Repository\Exceptions\NotFoundException;
use eZ\Publish\API\Repository\SectionService;
use eZ\Publish\Core\MVC\ConfigResolverInterface;
use eZ\Publish\Core\MVC\Symfony\View\Event\FilterViewBuilderParametersEvent;
Expand Down Expand Up @@ -103,8 +104,13 @@ public function handleSearchForm(FilterViewBuilderParametersEvent $event): void
$searchLanguage = null;

if (!empty($search['section'])) {
$section = $this->sectionService->loadSection($search['section']);
try {
$section = $this->sectionService->loadSection((int)$search['section']);
} catch (NotFoundException $e) {
$section = null;
}
}

if (!empty($search['content_types']) && \is_array($search['content_types'])) {
foreach ($search['content_types'] as $identifier) {
$contentTypes[] = $this->contentTypeService->loadContentTypeByIdentifier($identifier);
Expand Down

0 comments on commit 3f171cb

Please # to comment.