78 return is_subclass_of(
$targetType,
'TYPO3\\CMS\\Extbase\\DomainObject\\AbstractDomainObject');
88 if (is_string($source) || is_int($source)) {
91 if (isset($source[
'__identity'])) {
92 unset($source[
'__identity']);
94 return parent::getSourceChildPropertiesToBeConverted($source);
107 $configuredTargetType = $configuration->getConfigurationFor($propertyName)->getConfigurationValue(
'TYPO3\\CMS\\Extbase\\Property\\TypeConverter\\PersistentObjectConverter', self::CONFIGURATION_TARGET_TYPE);
108 if ($configuredTargetType !== NULL) {
109 return $configuredTargetType;
112 $specificTargetType = $this->objectContainer->getImplementationClassName(
$targetType);
113 $schema = $this->reflectionService->getClassSchema($specificTargetType);
114 if (!$schema->hasProperty($propertyName)) {
115 throw new \TYPO3\CMS\Extbase\Property\Exception\InvalidTargetException(
'Property "' . $propertyName .
'" was not found in target object of type "' . $specificTargetType .
'".', 1297978366);
117 $propertyInformation = $schema->getProperty($propertyName);
118 return $propertyInformation[
'type'] . ($propertyInformation[
'elementType'] !== NULL ?
'<' . $propertyInformation[
'elementType'] .
'>' :
'');
133 if (is_array($source)) {
136 && is_subclass_of(
$targetType,
'TYPO3\\CMS\\Extbase\\DomainObject\\AbstractValueObject')
140 unset($source[
'__identity']);
143 } elseif (is_string($source) || is_int($source)) {
144 if (empty($source)) {
149 throw new \InvalidArgumentException(
'Only integers, strings and arrays are accepted.', 1305630314);
151 foreach ($convertedChildProperties as $propertyName => $propertyValue) {
154 $exceptionMessage = sprintf(
155 'Property "%s" having a value of type "%s" could not be set in target object of type "%s". Make sure that the property is accessible properly, for example via an appropriate setter method.',
157 (is_object($propertyValue) ? get_class($propertyValue) : gettype($propertyValue)),
160 throw new \TYPO3\CMS\Extbase\Property\Exception\InvalidTargetException($exceptionMessage, 1297935345);
178 if (isset($source[
'__identity'])) {
181 if (count($source) > 1 && ($configuration === NULL || $configuration->getConfigurationValue(
'TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter', self::CONFIGURATION_MODIFICATION_ALLOWED) !== TRUE)) {
182 throw new \TYPO3\CMS\Extbase\Property\Exception\InvalidPropertyMappingConfigurationException(
'Modification of persistent objects not allowed. To enable this, you need to set the PropertyMappingConfiguration Value "CONFIGURATION_MODIFICATION_ALLOWED" to TRUE.', 1297932028);
185 if ($configuration === NULL || $configuration->getConfigurationValue(
'TYPO3\\CMS\\Extbase\\Property\\TypeConverter\\PersistentObjectConverter', self::CONFIGURATION_CREATION_ALLOWED) !== TRUE) {
186 throw new \TYPO3\CMS\Extbase\Property\Exception\InvalidPropertyMappingConfigurationException(
'Creation of objects not allowed. To enable this, you need to set the PropertyMappingConfiguration Value "CONFIGURATION_CREATION_ALLOWED" to TRUE');
203 if (ctype_digit((
string)$identity)) {
204 $object = $this->persistenceManager->getObjectByIdentifier($identity,
$targetType);
206 throw new \TYPO3\CMS\Extbase\Property\Exception\InvalidSourceException(
'The identity property "' . $identity .
'" is no UID.', 1297931020);
209 if ($object === NULL) {
210 throw new \TYPO3\CMS\Extbase\Property\Exception\TargetNotFoundException(
'Object with identity "' . print_r($identity, TRUE) .
'" not found.', 1297933823);
getTypeOfChildProperty($targetType, $propertyName, \TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration)
handleArrayData(array $source, $targetType, array &$convertedChildProperties, \TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration=NULL)
fetchObjectFromPersistence($identity, $targetType)
canConvertFrom($source, $targetType)
const CONFIGURATION_CREATION_ALLOWED
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
static setProperty(&$subject, $propertyName, $propertyValue, $forceDirectAccess=FALSE)
convertFrom($source, $targetType, array $convertedChildProperties=array(), \TYPO3\CMS\Extbase\Property\PropertyMappingConfigurationInterface $configuration=NULL)
buildObject(array &$possibleConstructorArgumentValues, $objectType)
const CONFIGURATION_MODIFICATION_ALLOWED
getSourceChildPropertiesToBeConverted($source)