Php 类型3跳过对象存储递归验证
我有打字错误3版本8.7.17 我有模型BookedDate,属性可用,链接到父模型。AvailableDate模型具有ObjectStorage属性BookedDates 我的验证失败,因为存在递归验证。我不需要它。我读过很多类似的问题,但没有找到好的解决方案或任何适合我的方法 我尝试了它和不同的属性路径变体:Php 类型3跳过对象存储递归验证,php,typo3,typo3-8.x,Php,Typo3,Typo3 8.x,我有打字错误3版本8.7.17 我有模型BookedDate,属性可用,链接到父模型。AvailableDate模型具有ObjectStorage属性BookedDates 我的验证失败,因为存在递归验证。我不需要它。我读过很多类似的问题,但没有找到好的解决方案或任何适合我的方法 我尝试了它和不同的属性路径变体: $this->arguments->getArgument($book) ->getPropertyMappingConfiguration()
$this->arguments->getArgument($book)
->getPropertyMappingConfiguration()
->forProperty('date.bookedDates.*')
->skipProperties('bookedDate');
我需要跳过bookeDate.date.bookeDates的验证,我遇到了类似的问题,但也没有人回复任何问题。 到目前为止,我能够通过自定义函数从单个关系属性中删除验证:
public function removePropertyValidation($argument, $property)
{
if ($this->arguments->hasArgument($argument)) {
/** @var \TYPO3\CMS\Extbase\Validation\Validator\ConjunctionValidator */
$conjunctionValidator = $this->arguments->getArgument($argument)->getValidator();
//get all validators for argument
foreach ($conjunctionValidator->getValidators() as $validator) {
if ($validator instanceof ConjunctionValidator) {
foreach ($validator->getValidators() as $validators) {
//get all validators for property
if ($validators instanceof GenericObjectValidator) {
foreach ($validators->getPropertyValidators($property) as $propertyValidator) {
//remove only standard validator
if ($propertyValidator instanceof ConjunctionValidator) {
foreach ($propertyValidator->getValidators() as $valid) {
$propertyValidator->removeValidator($valid);
}
}
}
}
}
}
}
}
}
然后在初始化操作中添加:
$this->removePropertyValidation('book', 'date');
谢谢你的代码。但这对我不起作用。我有一些对象BookedDate,这个对象有不同的属性,也有属性AvailableDate。我需要验证所有BookedDate属性,但不需要验证BookedDate属性的属性。