2 namespace TYPO3\CMS\Extbase\Validation\Validator;
28 'elementValidator' => array(null,
'The validator type to use for the collection elements',
'string'),
29 'elementType' => array(null,
'The type of the elements in the collection',
'string'),
30 'validationGroups' => array(null,
'The validation groups to link to',
'string'),
56 $this->result = new \TYPO3\CMS\Extbase\Error\Result();
58 if ($this->acceptsEmptyValues ===
false || $this->
isEmpty($value) ===
false) {
60 $this->
addError(
'The given subject was not a collection.', 1317204797);
62 }
elseif ($value instanceof \TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorage && !$value->isInitialized()) {
86 foreach ($value as $index => $collectionElement) {
87 if (isset($this->options[
'elementValidator'])) {
88 $collectionElementValidator = $this->validatorResolver->createValidator($this->options[
'elementValidator']);
89 }
elseif (isset($this->options[
'elementType'])) {
90 if (isset($this->options[
'validationGroups'])) {
91 $collectionElementValidator = $this->validatorResolver->getBaseValidatorConjunction($this->options[
'elementType'], $this->options[
'validationGroups']);
93 $collectionElementValidator = $this->validatorResolver->getBaseValidatorConjunction($this->options[
'elementType']);
99 $collectionElementValidator->setValidatedInstancesContainer($this->validatedInstancesContainer);
101 $this->result->forProperty($index)->merge($collectionElementValidator->validate($collectionElement));