From 37e42d049ccdfccd62c0220c4cd9c8ff22aa0d26 Mon Sep 17 00:00:00 2001 From: jygaulier Date: Tue, 30 Nov 2021 17:04:13 +0100 Subject: [PATCH] PHRAS-3584 fix api/v1/.../setcover ("Sub definition substituer locator was not set") original ticket #PHRAS-3592 --- lib/Alchemy/Phrasea/Controller/Api/V1Controller.php | 4 ++++ lib/classes/record/adapter.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php index 2d42130ff9..c8748cfc24 100644 --- a/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php +++ b/lib/Alchemy/Phrasea/Controller/Api/V1Controller.php @@ -30,6 +30,7 @@ use Alchemy\Phrasea\Cache\Cache; use Alchemy\Phrasea\Collection\Reference\CollectionReference; use Alchemy\Phrasea\Controller\Controller; use Alchemy\Phrasea\Core\Event\RecordEdit; +use Alchemy\Phrasea\Core\LazyLocator; use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Core\Version; use Alchemy\Phrasea\Databox\DataboxGroupable; @@ -2726,6 +2727,9 @@ class V1Controller extends Controller $ret = false; try { + $story->setSubDefinitionSubstituerLocator(new LazyLocator($this->app, 'subdef.substituer')); + $story->setDataboxLoggerLocator($this->app['phraseanet.logger']); + $ret = $story->setStoryCover($fromChildRecordId, $coverSources); } catch (\Exception $e) { diff --git a/lib/classes/record/adapter.php b/lib/classes/record/adapter.php index ad8347128e..a996fd645d 100644 --- a/lib/classes/record/adapter.php +++ b/lib/classes/record/adapter.php @@ -1052,7 +1052,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface foreach ($mandatoryParams as $k) { if (!array_key_exists($k, $params)) { - throw new Exception_InvalidArgument(sprintf('Invalid metadata, missing key %s', $param)); + throw new Exception_InvalidArgument(sprintf('Invalid metadata, missing key %s', $k)); } $params[$k] = trim($params[$k]); }