From d3553295e46b67f44bc327e884a624063162719c Mon Sep 17 00:00:00 2001 From: Lasse Mammen Date: Thu, 31 Jan 2019 14:07:05 +0000 Subject: [PATCH] Prevent unknown book types throwing exceptions for missing class Signed-off-by: Lasse Mammen --- src/Entity/Book.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Entity/Book.php b/src/Entity/Book.php index 6c1fa40..dbd3ed3 100644 --- a/src/Entity/Book.php +++ b/src/Entity/Book.php @@ -86,7 +86,13 @@ public static function getEntitiesFromArray(array $array) { $entities = array(); foreach ($array as $object) { - $entities[] = self::objectTransformer($object); + if (in_array( + $object['_type'], + array(self::TYPE_PDF, self::TYPE_AUDIO, self::TYPE_VIDEO), + true) + ) { + $entities[] = self::objectTransformer($object); + } } return $entities;