Skip to content

Commit

Permalink
Merge pull request #15 from daniellienert/task/listen-on-asset-update…
Browse files Browse the repository at this point in the history
…-signal

TASK: Listen on asset updated signal
  • Loading branch information
daniellienert authored Sep 11, 2018
2 parents 6c851bc + 0fd6a23 commit 6db6ec9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Classes/Domain/ExtractionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

use Neos\Flow\Annotations as Flow;
use Neos\Flow\ObjectManagement\Exception\UnknownObjectException;
use Neos\Flow\ObjectManagement\ObjectManager;
use Neos\Flow\Reflection\ReflectionService;
use Neos\Flow\ResourceManagement\PersistentResource as FlowResource;
Expand Down Expand Up @@ -53,6 +54,7 @@ class ExtractionManager
*
* @return MetaDataCollection
* @throws ExtractorException
* @throws UnknownObjectException
*/
public function extractMetaData(Asset $asset)
{
Expand Down
7 changes: 4 additions & 3 deletions Classes/Package.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class Package extends BasePackage
public function boot(Bootstrap $bootstrap)
{
$dispatcher = $bootstrap->getSignalSlotDispatcher();
$dispatcher->connect(AssetService::class, 'assetRemoved', ExtractionManager::class, 'extractMetaData');
$dispatcher->connect(AssetService::class, 'assetResourceReplaced', ExtractionManager::class, 'extractMetaData');
$package = $this;
$dispatcher->connect(
Sequence::class,
Expand All @@ -45,9 +43,10 @@ function (Step $step) use ($package, $bootstrap) {
}

/**
* Registers slots for signals in order to be able to index nodes
* Registers slots for signals in order to be able extract meta data from assets
*
* @param Bootstrap $bootstrap
* @throws \Neos\Flow\Exception
*/
public function registerExtractionSlot(Bootstrap $bootstrap)
{
Expand All @@ -57,6 +56,8 @@ public function registerExtractionSlot(Bootstrap $bootstrap)
if (isset($settings['realtimeExtraction']['enabled']) && $settings['realtimeExtraction']['enabled'] === true) {
$dispatcher = $bootstrap->getSignalSlotDispatcher();
$dispatcher->connect(AssetService::class, 'assetCreated', ExtractionManager::class, 'extractMetaData');
$dispatcher->connect(AssetService::class, 'assetUpdated', ExtractionManager::class, 'extractMetaData');
$dispatcher->connect(AssetService::class, 'assetRemoved', ExtractionManager::class, 'extractMetaData');
}
}
}

0 comments on commit 6db6ec9

Please sign in to comment.