From 9a053fbef5d0e2a5b72c6a88966c826f394599db Mon Sep 17 00:00:00 2001 From: himiklab Date: Tue, 2 Feb 2016 12:47:46 +0300 Subject: [PATCH] fix for PHP 7 --- Search.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Search.php b/Search.php index f652fac..0bef2c1 100644 --- a/Search.php +++ b/Search.php @@ -186,10 +186,13 @@ protected function createDocument($fields) { $document = new Document(); foreach ($fields as $field) { - if (!isset($field['type'])) { - $field['type'] = behaviors\SearchBehavior::FIELD_TEXT; + if (isset($field['type'])) { + $currentType = $field['type']; + } else { + $currentType = behaviors\SearchBehavior::FIELD_TEXT; } - $document->addField(Field::$field['type']( + + $document->addField(Field::$currentType( $field['name'], $field['value'] ));