PresetAssetImportException example

iterator_to_array($componentHandlers, false)
        );
        $this->rootDir = $rootDir;
    }

    /** * {@inheritdoc} */
    public function importElementAssets(Preset $preset$elementSyncKey)
    {
        if ($preset->getAssetsImported()) {
            throw new PresetAssetImportException('The assets for this preset are already imported.');
        }

        $presetData = json_decode($preset->getPresetData(), true);

        if (!$presetData || !\is_array($presetData) || !\array_key_exists('elements', $presetData)) {
            throw new PresetAssetImportException(sprintf('The preset data of the %s preset seems to be invalid.', $preset->getName()));
        }

        // continue if no sync data present or we just have an assets key which is empty         if (empty($presetData['syncData'])
            || (\count($presetData['syncData']) === 1 && empty($presetData['syncData']['assets']))
        )
Home | Imprint | This part of the site doesn't use cookies.