Skip to content

Commit

Permalink
Prevent unknown book types throwing exceptions for missing class
Browse files Browse the repository at this point in the history
Signed-off-by: Lasse Mammen <[email protected]>
  • Loading branch information
lkm committed Feb 14, 2019
1 parent ad5f389 commit d355329
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Entity/Book.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d355329

Please sign in to comment.