From cc87008e765f7e2119dcb4e6e55d2f25c0228921 Mon Sep 17 00:00:00 2001 From: Jan Henckens Date: Fri, 13 Aug 2021 17:59:59 +0200 Subject: [PATCH] Fixes a crash when using Scout with Commerce #178 --- CHANGELOG.md | 3 ++- src/ScoutIndex.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8c6094..02de1fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,12 @@ # Scout Changelog All notable changes to this project will be documented in this file. -## 2.4.1 - Unreleased +## 2.4.1 - 2021-08-13 ### Fixed - CP Utility now works for indexes using the wildcard selector for siteId ([#163](https://github.com/studioespresso/craft-scout/issues/163)) - CP Utility labels are now translatable +- Fixed compatibility with Craft Commerce ([#178](https://github.com/studioespresso/craft-scout/issues/178)) ## 2.3.1 - 2020-06-16 diff --git a/src/ScoutIndex.php b/src/ScoutIndex.php index 931e381..9372a29 100644 --- a/src/ScoutIndex.php +++ b/src/ScoutIndex.php @@ -42,7 +42,7 @@ public static function create(string $indexName): self public function elementType(string $class): self { - if (!(new $class()) instanceof Element) { + if (!is_subclass_of($class, Element::class)) { throw new Exception("Invalid Element Type {$class}"); }