Validates the provided collection create struct.

@throws \Netgen\BlockManager\Exception\Validation\ValidationException If the validation failed
553618
public function validateCollectionCreateStruct(CollectionCreateStruct $collectionCreateStruct): void
    {
        if ($collectionCreateStruct->queryCreateStruct !== null) {
            $this->validate(
                $collectionCreateStruct->queryCreateStruct,
                [
                    new Constraints\Type(['type' => QueryCreateStruct::class]),
                ],
                'queryCreateStruct'
            );

            $this->validateQueryCreateStruct($collectionCreateStruct->queryCreateStruct);
        }

        $offsetConstraints = [
            new Constraints\NotBlank(),
            new Constraints\Type(['type' => 'int']),
        ];

        $offsetConstraints[] = $collectionCreateStruct->queryCreateStruct !== null ?
            new Constraints\GreaterThanOrEqual(['value' => 0]) :
            new Constraints\EqualTo(['value' => 0]);

        $this->validate(
            $collectionCreateStruct->offset,
            $offsetConstraints,
            'offset'
        );

        if ($collectionCreateStruct->limit !== null) {
            $this->validate(
                $collectionCreateStruct->limit,
                [
                    new Constraints\Type(['type' => 'int']),
                    new Constraints\GreaterThan(['value' => 0]),
                ],
                'limit'
            );
        }
    }
747795
protected function validateCollectionItem()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->collection_item->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('Collection item'));
            return false;
        }

        $this->setSubmitted('update', $data);
        return true;
    }
537428
public function validate()
    {
        foreach ($this->fieldSet as $name => $field) {
            $field->validate();

            if (!$field->isValid()) {
                $this->valid = false;
            }
        }

        $this->validated = true;
    }
1165983
public function validate()
	{
		$varValue = $this->getPost($this->strName);

		if (!empty($varValue) && !$this->isValidOption($varValue))
		{
			$this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['invalid'], (is_array($varValue) ? implode(', ', $varValue) : $varValue)));
		}

		parent::validate();
	}
267402
public function validate() {

		if ($this->getAmountIncludingTax() === null) {
			throw new ValidationException("'amountIncludingTax' can't be null", 'amountIncludingTax', $this);
		}
		if ($this->getExternalId() === null) {
			throw new ValidationException("'externalId' can't be null", 'externalId', $this);
		}
		if ($this->getQuantity() === null) {
			throw new ValidationException("'quantity' can't be null", 'quantity', $this);
		}
		if ($this->getSubscriptionVersion() === null) {
			throw new ValidationException("'subscriptionVersion' can't be null", 'subscriptionVersion', $this);
		}
		if ($this->getTitle() === null) {
			throw new ValidationException("'title' can't be null", 'title', $this);
		}
	}
85546
public function validate() {
		parent::validate();

		if ($this->getEntity() === null) {
			throw new ValidationException("'entity' can't be null", 'entity', $this);
		}
		if ($this->getEntityStates() === null) {
			throw new ValidationException("'entityStates' can't be null", 'entityStates', $this);
		}
		if ($this->getUrl() === null) {
			throw new ValidationException("'url' can't be null", 'url', $this);
		}
	}
755638
public function validate($check_children = true)
    {
        //validate
        foreach (static::getProperties() as $property => $meta) {
            $mandatory = $meta[self::KEY_MANDATORY];

            //If it's got a GUID, it's already going to be valid almost all cases
            if (! $this->hasGUID() && $mandatory) {
                if (! isset($this->_data[$property]) || empty($this->_data[$property])) {
                    throw new Exception(
                        sprintf(
                            '%s::$%s is mandatory and is either missing or empty.',
                            get_class($this),
                            $property
                        )
                    );
                }

                if ($check_children) {
                    if ($this->_data[$property] instanceof self) {
                        //Keep IDEs happy
                        /** @var self $obj */
                        $obj = $this->_data[$property];
                        $obj->validate();
                    } elseif ($this->_data[$property] instanceof Collection) {
                        foreach ($this->_data[$property] as $element) {
                            if ($element instanceof self) {
                                $element->validate();
                            }
                        }
                    }
                }
            }
        }

        return true;
    }
1040358
protected function validateTypeCollection()
    {
        $field = 'type';

        if ($this->isExcluded($field) || $this->isUpdating()) {
            return null; // Do not check type on update - it cannot be changed and will be ignored
        }

        $value = $this->getSubmitted($field);
        $label = $this->translation->text('Type');

        if (empty($value)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        $types = $this->collection->getTypes();

        if (!isset($types[$value])) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        return true;
    }
249089
protected function validateEditCollectionItem()
    {
        $this->setSubmitted('collection_item');
        $this->setSubmittedBool('status');
        $this->setSubmitted('update', $this->data_collection_item);
        $this->setSubmitted('collection_id', $this->data_collection['collection_id']);

        $this->validateComponent('collection_item');
        return !$this->hasErrors();
    }
560653
public function validate()
    {
        if ($this->getError() === null) {
            $this->verifySettings();
        }
        if ($this->getError() !== null) {
            throw new BuildException($this->errmsg, $this->cause);
        }
    }
856484
public function dataValid()
    {
        foreach (new \RecursiveIteratorIterator($this,
                                                \RecursiveIteratorIterator::SELF_FIRST) as $child) {
            if ($child instanceof FormElement && !$child->dataValid()) {
                return false;
            }
        }

        return true;
    }
834369
protected function validate()
    {
        $rules = $this->mergeRules();

        if ( empty($rules) ) return true;

        $data = $this->attributes;

        $validator = Validator::make($data, $rules);
        $success = $validator->passes();

        if ( $success )
        {
            if ( $this->validationErrors->count() > 0 )
            {
                $this->validationErrors = new MessageBag;
            }
        } else
        {
            $this->validationErrors = $validator->messages();
            throw new ValidationErrorException($validator->messages());
        }

        $this->valid = true;

        return $success;
    }
17360
public function validateTargetCreateStruct(TargetCreateStruct $targetCreateStruct): void
    {
        $this->validate(
            $targetCreateStruct->type,
            [
                new Constraints\NotBlank(),
                new Constraints\Type(['type' => 'string']),
            ],
            'type'
        );

        $targetType = $this->targetTypeRegistry->getTargetType($targetCreateStruct->type);

        $this->validate(
            $targetCreateStruct->value,
            $targetType->getConstraints(),
            'value'
        );
    }
1329865
private function validateAllRequired($isCreating) {
        foreach($this->getFiles() as $file) {
            if(!$file->isUsed()) {
                if($isCreating ? $file->isRequiredOnCreate() : $file->isRequiredOnUpdate()) {
                    $this->getEntity()->appendMessage(new Message('Missing the required file of: ' . $file->getName()));
                }
            }
        }
        if($this->getEntity()->validationHasFailed() == true) {
            $validationException = new ValidationException();
            $validationException->setEntity($this->getEntity());
            throw $validationException;
        }
    }
988014
protected function validate_data() {
        parent::validate_data();
        if (!isset($this->context)) {
            throw new \coding_exception('The \'context\' must be set.');
        }
        if (!isset($this->objectid)) {
            throw new \coding_exception('The \'objectid\' must be set.');
        }
        if (!isset($this->other['eventtype'])) {
            throw new \coding_exception('The \'eventtype\' value must be set in other.');
        }
        if ($this->other['eventtype'] == 'course' || $this->other['eventtype'] == 'group') {
            if (!isset($this->other['courseid'])) {
                throw new \coding_exception('The \'courseid\' value must be set in other.');
            }
            if ($this->other['eventtype'] == 'group' && !isset($this->other['groupid'])) {
                throw new \coding_exception('The \'groupid\' value must be set in other.');
            }
        }
        if ($this->other['eventtype'] == 'category' && !isset($this->other['categoryid'])) {
            throw new \coding_exception('The \'categoryid\' value must be set in other.');
        }
    }
326688
protected function validate()
    {
        if (empty($this->schemaFilesets)) {
            throw new BuildException("You must specify a fileset of XML schemas.", $this->getLocation());
        }

        // Make sure the output directory is set.
        if ($this->outputDirectory === null) {
            throw new BuildException("The output directory needs to be defined!", $this->getLocation());
        }

        if ($this->validate) {
            if (!$this->xsdFile) {
                throw new BuildException("'validate' set to TRUE, but no XSD specified (use 'xsd' attribute).", $this->getLocation());
            }
        }
    }
467314
public function validate($model, $validators = null)
    {
        if (isset($validators) && is_array($validators)) {
            $validation = $this->validateArray($model, $validators);
        } else {
            $validation = $this->validateModel($model);
        }
        if ($validation) {
            $errors = $validation->validate($model);
            if (count($errors)) {
                throw new ValidationException($errors);
            }
        }
    }