Neos\Media\TypeConverter\ArrayConverter::convertFrom PHP Метод

convertFrom() публичный Метод

Convert an object from $source to an array
public convertFrom ( Neos\Media\Domain\Model\AssetInterface $source, string $targetType, array $convertedChildProperties = [], Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : array
$source Neos\Media\Domain\Model\AssetInterface
$targetType string
$convertedChildProperties array
$configuration Neos\Flow\Property\PropertyMappingConfigurationInterface
Результат array The converted asset or NULL
    public function convertFrom($source, $targetType, array $convertedChildProperties = array(), PropertyMappingConfigurationInterface $configuration = null)
    {
        $identity = $this->persistenceManager->getIdentifierByObject($source);
        switch (true) {
            case $source instanceof ImageVariant:
                if (!isset($convertedChildProperties['originalAsset']) || !is_array($convertedChildProperties['originalAsset'])) {
                    return null;
                }
                $convertedChildProperties['originalAsset']['__identity'] = $this->persistenceManager->getIdentifierByObject($source->getOriginalAsset());
                return array('__identity' => $identity, '__type' => \Neos\Media\Domain\Model\ImageVariant::class, 'originalAsset' => $convertedChildProperties['originalAsset'], 'adjustments' => $convertedChildProperties['adjustments']);
            case $source instanceof AssetInterface:
                if (!isset($convertedChildProperties['resource']) || !is_array($convertedChildProperties['resource'])) {
                    return null;
                }
                $convertedChildProperties['resource']['__identity'] = $this->persistenceManager->getIdentifierByObject($source->getResource());
                return array('__identity' => $identity, '__type' => \Neos\Utility\TypeHandling::getTypeForValue($source), 'title' => $source->getTitle(), 'resource' => $convertedChildProperties['resource']);
        }
    }