PHRAS-3584

fix api/v1/.../setcover ("Sub definition substituer locator was not set")
original ticket #PHRAS-3592
This commit is contained in:
jygaulier
2021-11-30 17:04:13 +01:00
parent 8b34eb49b7
commit 37e42d049c
2 changed files with 5 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ use Alchemy\Phrasea\Cache\Cache;
use Alchemy\Phrasea\Collection\Reference\CollectionReference; use Alchemy\Phrasea\Collection\Reference\CollectionReference;
use Alchemy\Phrasea\Controller\Controller; use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\Core\Event\RecordEdit; use Alchemy\Phrasea\Core\Event\RecordEdit;
use Alchemy\Phrasea\Core\LazyLocator;
use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\Core\Version; use Alchemy\Phrasea\Core\Version;
use Alchemy\Phrasea\Databox\DataboxGroupable; use Alchemy\Phrasea\Databox\DataboxGroupable;
@@ -2726,6 +2727,9 @@ class V1Controller extends Controller
$ret = false; $ret = false;
try { try {
$story->setSubDefinitionSubstituerLocator(new LazyLocator($this->app, 'subdef.substituer'));
$story->setDataboxLoggerLocator($this->app['phraseanet.logger']);
$ret = $story->setStoryCover($fromChildRecordId, $coverSources); $ret = $story->setStoryCover($fromChildRecordId, $coverSources);
} }
catch (\Exception $e) { catch (\Exception $e) {

View File

@@ -1052,7 +1052,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
foreach ($mandatoryParams as $k) { foreach ($mandatoryParams as $k) {
if (!array_key_exists($k, $params)) { 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]); $params[$k] = trim($params[$k]);
} }