diff --git a/lib/Alchemy/Phrasea/Controller/DatafileController.php b/lib/Alchemy/Phrasea/Controller/DatafileController.php index c6449111ae..15fb91a3ae 100644 --- a/lib/Alchemy/Phrasea/Controller/DatafileController.php +++ b/lib/Alchemy/Phrasea/Controller/DatafileController.php @@ -44,11 +44,9 @@ class DatafileController extends AbstractDelivery if ($subdef != 'thumbnail') { $all_access = false; - $subdefStruct = $databox->get_subdef_structure(); - - if ($subdefStruct->getSubdefGroup($record->get_type())) { - foreach ($subdefStruct->getSubdefGroup($record->get_type()) as $subdefObj) { - /** @var \databox_subdef $subdefObj */ + $subdefGroup = $databox->get_subdef_structure()->getSubdefGroup($record->getType()); + if ($subdefGroup) { + foreach ($subdefGroup as $subdefObj) { if ($subdefObj->get_name() == $subdef) { if ($subdefObj->get_class() == 'thumbnail') { $all_access = true; @@ -75,7 +73,7 @@ class DatafileController extends AbstractDelivery try { $subdef_class = $databox ->get_subdef_structure() - ->get_subdef($record->get_type(), $subdef) + ->get_subdef($record->getType(), $subdef) ->get_class(); } catch (\Exception_Databox_SubdefNotFound $e) { diff --git a/lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php b/lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php index da497eb9ec..cd22dc8740 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php @@ -73,7 +73,7 @@ class ToolsController extends Controller continue; } - $label = $databoxSubdefs[$subdefName]->get_label($this->app['locale']); + $label = $databoxSubdefs->getSubdef($subdefName)->get_label($this->app['locale']); } $recordAccessibleSubdefs[] = array( 'name' => $subdef->get_name(), diff --git a/lib/Alchemy/Phrasea/Media/SubdefGenerator.php b/lib/Alchemy/Phrasea/Media/SubdefGenerator.php index 3168417c49..47ce36fe97 100644 --- a/lib/Alchemy/Phrasea/Media/SubdefGenerator.php +++ b/lib/Alchemy/Phrasea/Media/SubdefGenerator.php @@ -50,6 +50,7 @@ class SubdefGenerator { if (null === $subdefs = $record->getDatabox()->get_subdef_structure()->getSubdefGroup($record->getType())) { $this->logger->info(sprintf('Nothing to do for %s', $record->getType())); + $subdefs = []; } $this->dispatch(