AssetInterfaceConverter
class AssetInterfaceConverter extends PersistentObjectConverter (View source)
This converter transforms to \Neos\Media\Domain\Model\ImageInterface (Image or ImageVariant) objects.
Constants
CONFIGURATION_ONE_PER_RESOURCE |
|
Properties
protected array | $sourceTypes | ||
protected string | $targetType | ||
protected int | $priority | ||
protected AssetRepository | $assetRepository | ||
protected PersistenceManagerInterface | $persistenceManager | ||
protected AssetModelMappingStrategyInterface | $assetModelMappingStrategy | ||
protected ResourceManager | $resourceManager | ||
static protected string | $defaultNewAssetType | If creating a new asset from this converter this defines the default type as fallback. |
|
protected array | $resourcesAlreadyConvertedToAssets | Maps resource identifiers to assets that already got created during the current request. |
Methods
If $source has an identity, we have a persisted Image, and therefore this type converter should withdraw and let the PersistedObjectConverter kick in.
All properties in the source array except __identity and adjustments are sub-properties.
Convert the property "resource"
Determines the target type based on the source's (optional) __type key.
Convert an object from $source to an \Neos\Media\Domain\Model\AssetInterface implementation
Builds a new instance of $objectType with the given $possibleConstructorArgumentValues.
Fetch an object from persistence layer.
No description
Applies the model mapping strategy for a converted resource to determine the final target type.
Details
bool
canConvertFrom(mixed $source, string $targetType)
If $source has an identity, we have a persisted Image, and therefore this type converter should withdraw and let the PersistedObjectConverter kick in.
array
getSourceChildPropertiesToBeConverted(mixed $source)
All properties in the source array except __identity and adjustments are sub-properties.
string
getTypeOfChildProperty(string $targetType, string $propertyName, PropertyMappingConfigurationInterface $configuration)
Convert the property "resource"
string
getTargetTypeForSource(mixed $source, string $originalTargetType, PropertyMappingConfigurationInterface $configuration = null)
Determines the target type based on the source's (optional) __type key.
Error|AssetInterface
convertFrom(mixed $source, string $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)
Convert an object from $source to an \Neos\Media\Domain\Model\AssetInterface implementation
protected object
buildObject(array $possibleConstructorArgumentValues, string $objectType)
Builds a new instance of $objectType with the given $possibleConstructorArgumentValues.
If constructor argument values are missing from the given array the method looks for a default value in the constructor signature.
Furthermore, the constructor arguments are removed from $possibleConstructorArgumentValues
protected object
fetchObjectFromPersistence(mixed $identity, string $targetType)
Fetch an object from persistence layer.
protected AssetInterface|null
applyTypeSpecificHandling(AssetInterface $asset, mixed $source, array $convertedChildProperties, PropertyMappingConfigurationInterface $configuration)
No description
protected string
applyModelMappingStrategy(string $originalTargetType, PersistentResource $resource, array $source = [])
Applies the model mapping strategy for a converted resource to determine the final target type.
The strategy is NOT applied if $source['__type'] is set (overriding was allowed then, otherwise an exception would have been thrown earlier).