buildsubdef with worker

This commit is contained in:
aynsix
2019-09-20 16:01:48 +04:00
parent 861785e7ab
commit 7541885637
11 changed files with 90 additions and 15 deletions

View File

@@ -14,6 +14,8 @@ use Alchemy\Phrasea\Application\Helper\EntityManagerAware;
use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\Controller\RecordsRequest;
use Alchemy\Phrasea\Controller\Exception as ControllerException;
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
use Alchemy\Phrasea\Core\Event\Record\SubdefinitionBuildEvent;
use Alchemy\Phrasea\Core\Event\RecordEdit;
use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\Model\Entities\StoryWZ;
@@ -68,7 +70,9 @@ class StoryController extends Controller
break;
}
$story->set_metadatas($metadatas)->rebuild_subdefs();
$recordAdapter = $story->set_metadatas($metadatas);
// tell phraseanet to rebuild subdef
$this->dispatch(RecordEvents::SUBDEFINITION_BUILD, new SubdefinitionBuildEvent($recordAdapter));
$storyWZ = new StoryWZ();
$storyWZ->setUser($this->getAuthenticatedUser());

View File

@@ -16,6 +16,7 @@ use Alchemy\Phrasea\Application\Helper\SubDefinitionSubstituerAware;
use Alchemy\Phrasea\Controller\Controller;
use Alchemy\Phrasea\Controller\RecordsRequest;
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
use Alchemy\Phrasea\Core\Event\Record\SubdefinitionBuildEvent;
use Alchemy\Phrasea\Exception\RuntimeException;
use Alchemy\Phrasea\Metadata\PhraseanetMetadataReader;
use Alchemy\Phrasea\Metadata\PhraseanetMetadataSetter;
@@ -156,7 +157,7 @@ class ToolsController extends Controller
}
if (!$substituted || $force) {
$record->rebuild_subdefs();
$this->dispatch(RecordEvents::SUBDEFINITION_BUILD, new SubdefinitionBuildEvent($record));
}
}