175 if (!is_string(
$name)) {
176 throw new \InvalidArgumentException(
'$name must be of type string, ' . gettype(
$name) .
' given.', 1187951688);
178 if (strlen(
$name) === 0) {
179 throw new \InvalidArgumentException(
'$name must be a non-empty string, ' . strlen(
$name) .
' characters given.', 1232551853);
192 $this->dataTypeClassSchema = strpbrk($this->dataType,
'_\\') !== FALSE ? $this->reflectionService->getClassSchema($this->dataType) : NULL;
201 $this->dataType = $this->typeHandlingService->normalizeType($this->dataType);
224 throw new \InvalidArgumentException(
'$shortName must be a single character or NULL', 1195824959);
249 $this->dataTypeClassSchema = $this->reflectionService->getClassSchema(
$dataType);
328 if ($this->validator === NULL) {
329 $this->validator = $this->objectManager->get(
'TYPO3\\CMS\\Extbase\\Validation\\Validator\\ConjunctionValidator');
331 foreach ($objectNames as $objectName) {
332 if (!class_exists($objectName)) {
333 $objectName =
'Tx_Extbase_Validation_Validator_' . $objectName;
335 $this->validator->addValidator($this->objectManager->get($objectName));
368 if ($this->configurationManager->isFeatureEnabled(
'rewrittenPropertyMapper')) {
369 if ($rawValue === NULL) {
374 $this->value = $rawValue;
378 $this->value = $this->propertyMapper->convert($rawValue, $this->dataType, $this->propertyMappingConfiguration);
385 $this->validationResults = $this->propertyMapper->getMessages();
386 if ($this->validator !== NULL) {
388 $validationMessages = $this->validator->validate($this->value);
389 $this->validationResults->merge($validationMessages);
393 if ($rawValue === NULL || is_object($rawValue) && $rawValue instanceof $this->dataType) {
394 $this->value = $rawValue;
415 if (!class_exists($this->dataType)) {
418 $transformedValue = NULL;
419 if ($this->dataTypeClassSchema !== NULL) {
422 $this->origin = self::ORIGIN_PERSISTENCE;
424 } elseif (is_array(
$value)) {
425 $this->origin = self::ORIGIN_PERSISTENCE_AND_MODIFIED;
426 $transformedValue = $this->deprecatedPropertyMapper->map(array_keys(
$value),
$value, $this->dataType);
430 throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentValueException(
'The value was a simple type, so we could not map it to an object. Maybe the @entity or @valueobject annotations are missing?', 1251730701);
432 $this->origin = self::ORIGIN_NEWLY_CREATED;
433 $transformedValue = $this->deprecatedPropertyMapper->map(array_keys(
$value),
$value, $this->dataType);
435 if (!$transformedValue instanceof $this->dataType && ($transformedValue !== NULL || $this->
isRequired())) {
436 throw new \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentValueException(
'The value must be of type "' . $this->dataType .
'", but was of type "' . (is_object($transformedValue) ? get_class($transformedValue) : gettype($transformedValue)) .
'".' . ($this->deprecatedPropertyMapper->getMappingResults()->hasErrors() ?
'<p>' . implode(
'<br />', $this->deprecatedPropertyMapper->getMappingResults()->getErrors()) .
'</p>' :
''), 1251730702);
438 return $transformedValue;
448 $query = $this->queryFactory->create($this->dataType);
449 $query->getQuerySettings()->setRespectSysLanguage(FALSE);
450 $query->getQuerySettings()->setRespectStoragePage(FALSE);
451 return $query->matching($query->equals(
'uid',
$uid))->execute()->getFirst();
461 if ($this->value === NULL) {
475 return $this->value !== NULL;
493 return !$this->validationResults->hasErrors();
$deprecatedPropertyMapper
setNewValidatorConjunction(array $objectNames)
injectTypeHandlingService(\TYPO3\CMS\Extbase\Service\TypeHandlingService $typeHandlingService)
__construct($name, $dataType)
setValidator(\TYPO3\CMS\Extbase\Validation\Validator\ValidatorInterface $validator)
const ORIGIN_PERSISTENCE_AND_MODIFIED
getPropertyMappingConfiguration()
const ORIGIN_NEWLY_CREATED
$propertyMappingConfiguration
injectReflectionService(\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService)
setDefaultValue($defaultValue)