Neos.Media/Classes/Domain/Model/ImportedAssetManager.php
public function registerCreatedAsset(AssetInterface $asset)
    {
        if (!$asset instanceof AssetVariantInterface || !$asset instanceof AssetSourceAwareInterface) {
            return;
        }

        $variantAssetIdentifier = $this->persistenceManager->getIdentifierByObject($asset);
        $originalAsset = $asset->getOriginalAsset();
        $originalAssetIdentifier = $this->persistenceManager->getIdentifierByObject($originalAsset);

        $originalImportedAsset = $this->importedAssetRepository->findOneByLocalAssetIdentifier($originalAssetIdentifier);
        if ($originalImportedAsset instanceof ImportedAsset) {
            $asset->setAssetSourceIdentifier($originalImportedAsset->getAssetSourceIdentifier());

            $variantImportedAsset = new ImportedAsset(
                $originalImportedAsset->getAssetSourceIdentifier(),
                $originalImportedAsset->getRemoteAssetIdentifier(),
                $variantAssetIdentifier, new \DateTimeImmutable(),
                $originalAssetIdentifier
            );

            $this->importedAssetRepository->add($variantImportedAsset);
            $this->logger->debug(sprintf('Asset created: %s / %s', $asset->getResource()->getFilename(), $this->persistenceManager->getIdentifierByObject($asset)));
        }
    }
public function registerCreatedAsset(AssetInterface $asset)
    {
        if (!$asset instanceof AssetVariantInterface || !$asset instanceof AssetSourceAwareInterface) {
            return;
        }

        $variantAssetIdentifier = $this->persistenceManager->getIdentifierByObject($asset);
        $originalAsset = $asset->getOriginalAsset();
        $originalAssetIdentifier = $this->persistenceManager->getIdentifierByObject($originalAsset);

        $originalImportedAsset = $this->importedAssetRepository->findOneByLocalAssetIdentifier($originalAssetIdentifier);
        if ($originalImportedAsset instanceof ImportedAsset) {
            $asset->setAssetSourceIdentifier($originalImportedAsset->getAssetSourceIdentifier());

            $variantImportedAsset = new ImportedAsset(
                $originalImportedAsset->getAssetSourceIdentifier(),
                $originalImportedAsset->getRemoteAssetIdentifier(),
                $variantAssetIdentifier, new \DateTimeImmutable(),
                $originalAssetIdentifier
            );

            $this->importedAssetRepository->add($variantImportedAsset);
            $this->logger->debug(sprintf('Asset created: %s / %s', $asset->getResource()->getFilename(), $this->persistenceManager->getIdentifierByObject($asset)));
        }
    }
public function registerCreatedAsset ( AssetInterface $ asset ) { if ( ! $ asset instanceof AssetVariantInterface || ! $ asset instanceof AssetSourceAwareInterface ) { return ; } $ variantAssetIdentifier = $ this -> persistenceManager -> getIdentifierByObject ( $ asset ) ; $ originalAsset = $ asset -> getOriginalAsset ( ) ; $ originalAssetIdentifier = $ this -> persistenceManager -> getIdentifierByObject ( $ originalAsset ) ; $ originalImportedAsset = $ this -> importedAssetRepository -> findOneByLocalAssetIdentifier ( $ originalAssetIdentifier ) ; if ( $ originalImportedAsset instanceof ImportedAsset ) { $ asset -> setAssetSourceIdentifier ( $ originalImportedAsset -> getAssetSourceIdentifier ( ) ) ; $ variantImportedAsset = new ImportedAsset ( $ originalImportedAsset -> getAssetSourceIdentifier ( ) , $ originalImportedAsset -> getRemoteAssetIdentifier ( ) , $ variantAssetIdentifier , new \ DateTimeImmutable ( ) , $ originalAssetIdentifier ) ; $ this -> importedAssetRepository -> add ( $ variantImportedAsset ) ; $ this -> logger -> debug ( sprintf ( 'Asset created: %s / %s' , $ asset -> getResource ( ) -> getFilename ( ) , $ this -> persistenceManager -> getIdentifierByObject ( $ asset ) ) ) ; } }
Register that an asset was created.

Wired via signal-slot with AssetService::assetCreated – see Package.php

@param AssetInterface $asset
@throws IllegalObjectTypeException
Register that an asset was created .