PHP Класс Neos\Flow\Property\TypeConverter\PersistentObjectConverter
- If the input is string, it is assumed to be a UUID. Then, the object is fetched from persistence.
- If the input is array, we check if it has an identity property.
- If the input has NO identity property, but additional properties, we create a new object and return it.
However, we only do this if the configuration option "CONFIGURATION_CREATION_ALLOWED" is TRUE.
- If the input has an identity property AND the configuration option "CONFIGURATION_IDENTITY_CREATION_ALLOWED" is set,
we fetch the object from persistent or create a new object if none was found and then set the sub-properties.
- If the input has an identity property and NO additional properties, we fetch the object from persistence.
- If the input has an identity property AND additional properties, we fetch the object from persistence,
and set the sub-properties. We only do this if the configuration option "CONFIGURATION_MODIFICATION_ALLOWED" is TRUE.
Показать файл
Открыть проект
Примеры использования класса
Защищенные свойства (Protected)
Открытые методы
Метод |
Описание |
|
canConvertFrom ( mixed $source, string $targetType ) : boolean |
We can only convert if the $targetType is either tagged with entity or value object. |
|
convertFrom ( mixed $source, string $targetType, array $convertedChildProperties = [], Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : object | Neos\Flow\Property\TypeConverter\Error\TargetNotFoundError |
Convert an object from $source to an entity or a value object. |
|
getSourceChildPropertiesToBeConverted ( mixed $source ) : array |
All properties in the source array except __identity are sub-properties. |
|
getTypeOfChildProperty ( string $targetType, string $propertyName, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration ) : string |
The type of a property is determined by the reflection service. |
|
Защищенные методы
Описание методов
canConvertFrom()
публичный Метод
We can only convert if the $targetType is either tagged with entity or value object.
convertFrom()
публичный Метод
Convert an object from $source to an entity or a value object.
public convertFrom ( mixed $source, string $targetType, array $convertedChildProperties = [], Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : object | Neos\Flow\Property\TypeConverter\Error\TargetNotFoundError |
$source |
mixed |
|
$targetType |
string |
|
$convertedChildProperties |
array |
|
$configuration |
Neos\Flow\Property\PropertyMappingConfigurationInterface |
|
Результат |
object | Neos\Flow\Property\TypeConverter\Error\TargetNotFoundError |
the converted entity/value object or an instance of TargetNotFoundError if the object could not be resolved |
fetchObjectFromPersistence()
защищенный Метод
Fetch an object from persistence layer.
findObjectByIdentityProperties()
защищенный Метод
Finds an object from the repository by searching for its identity properties.
getSourceChildPropertiesToBeConverted()
публичный Метод
All properties in the source array except __identity are sub-properties.
getTypeOfChildProperty()
публичный Метод
The type of a property is determined by the reflection service.
handleArrayData()
защищенный Метод
Handle the case if $source is an array.
protected handleArrayData ( array $source, string $targetType, array &$convertedChildProperties, Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : object | Neos\Flow\Property\TypeConverter\Error\TargetNotFoundError |
$source |
array |
|
$targetType |
string |
|
$convertedChildProperties |
array |
|
$configuration |
Neos\Flow\Property\PropertyMappingConfigurationInterface |
|
Результат |
object | Neos\Flow\Property\TypeConverter\Error\TargetNotFoundError |
|
setIdentity()
защищенный Метод
Set the given $identity on the created $object.
Описание свойств
$persistenceManager защищенное свойство
protected PersistenceManagerInterface,Neos\Flow\Persistence $persistenceManager |
Результат |
Neos\Flow\Persistence\PersistenceManagerInterface |
|
$priority защищенное свойство
protected int $priority |
Результат |
integer |
|
$sourceTypes защищенное свойство
protected array $sourceTypes |
Результат |
array |
|