PHP Класс Neos\Flow\Property\TypeConverter\ObjectConverter

This converter will only be used on target types that are not entities or value objects (for those the PersistentObjectConverter is used). The target type can be overridden in the source by setting the __type key to the desired value. The converter will return an instance of the target type with all properties given in the source array set to the respective values. For the mechanics used to set the values see ObjectAccess::setProperty().
Наследование: extends AbstractTypeConverter
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$constructorReflectionFirstLevelCache array As it is very likely that the constructor arguments are needed twice we should cache them for the request.
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
$priority integer
$reflectionService Neos\Flow\Reflection\ReflectionService
$sourceTypes array
$targetType string

Открытые методы

Метод Описание
canConvertFrom ( mixed $source, string $targetType ) : boolean Only convert non-persistent types
convertFrom ( mixed $source, string $targetType, array $convertedChildProperties = [], Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : object Convert an object from $source to an object.
getSourceChildPropertiesToBeConverted ( mixed $source ) : array Convert all properties in the source array
getTargetTypeForSource ( mixed $source, string $originalTargetType, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : string Determines the target type based on the source's (optional) __type key.
getTypeOfChildProperty ( string $targetType, string $propertyName, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration ) : string The type of a property is determined by the reflection service.

Защищенные методы

Метод Описание
buildObject ( array &$possibleConstructorArgumentValues, string $objectType ) : object Builds a new instance of $objectType with the given $possibleConstructorArgumentValues.
getConstructorArgumentsForClass ( string $className ) : array Get the constructor argument reflection for the given object type.

Описание методов

buildObject() защищенный Метод

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 buildObject ( array &$possibleConstructorArgumentValues, string $objectType ) : object
$possibleConstructorArgumentValues array
$objectType string
Результат object The created instance

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

Only convert non-persistent types
public canConvertFrom ( mixed $source, string $targetType ) : boolean
$source mixed
$targetType string
Результат boolean

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

Convert an object from $source to an object.
public convertFrom ( mixed $source, string $targetType, array $convertedChildProperties = [], Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : object
$source mixed
$targetType string
$convertedChildProperties array
$configuration Neos\Flow\Property\PropertyMappingConfigurationInterface
Результат object the target type

getConstructorArgumentsForClass() защищенный Метод

Get the constructor argument reflection for the given object type.
protected getConstructorArgumentsForClass ( string $className ) : array
$className string
Результат array

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

Convert all properties in the source array
public getSourceChildPropertiesToBeConverted ( mixed $source ) : array
$source mixed
Результат array

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

Determines the target type based on the source's (optional) __type key.
public getTargetTypeForSource ( mixed $source, string $originalTargetType, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : string
$source mixed
$originalTargetType string
$configuration Neos\Flow\Property\PropertyMappingConfigurationInterface
Результат string

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

The type of a property is determined by the reflection service.
public getTypeOfChildProperty ( string $targetType, string $propertyName, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration ) : string
$targetType string
$propertyName string
$configuration Neos\Flow\Property\PropertyMappingConfigurationInterface
Результат string

Описание свойств

$constructorReflectionFirstLevelCache защищенное свойство

As it is very likely that the constructor arguments are needed twice we should cache them for the request.
protected array $constructorReflectionFirstLevelCache
Результат array

$objectManager защищенное свойство

protected ObjectManagerInterface,Neos\Flow\ObjectManagement $objectManager
Результат Neos\Flow\ObjectManagement\ObjectManagerInterface

$priority защищенное свойство

protected int $priority
Результат integer

$reflectionService защищенное свойство

protected ReflectionService,Neos\Flow\Reflection $reflectionService
Результат Neos\Flow\Reflection\ReflectionService

$sourceTypes защищенное свойство

protected array $sourceTypes
Результат array

$targetType защищенное свойство

protected string $targetType
Результат string