在将我的typo3系统从4.5版更新到6.2后,我遇到了一些问题。 如果我尝试打开操作链接,我会收到一条错误消息。
Invalid validate annotation in Tx_UserAguGb_Controller_RiskAssessmentController->deleteAction():
Could not resolve class name for validator "Tx_UserAguGb_Domain_Validator_AssessmentAccess".
项目结构:
以下是一些代码段。
RiskAssessmentController.php
class Tx_UserAguGb_Controller_RiskAssessmentController extends Tx_UserAguGb_Controller_ExtendedController {
/**
* @param Tx_UserAguGb_Domain_Model_HazardAssessment|null $assessment
* @validate $assessment Tx_UserAguGb_Domain_Validator_AssessmentAccess
* @return void
*/
public function deleteAction(Tx_UserAguGb_Domain_Model_HazardAssessment $assessment = NULL) {
$this->hazardAssessmentRepository->remove($assessment);
$this->redirect('list');
}
?>
AssessmentAcess.php
<?php
class Tx_UserAguGb_Domain_Validator_AssessmentAccess extends \TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator {
public function isValid($value)
{
someCode()...
}
}
?>
List.html
<f:link.action action="delete"
class="assessment-button"
controller="RiskAssessment"
additionalAttributes="{data-confirm:alert-delete_assessment}"
arguments="{assessment: assessment}">
<f:translate key="button-delete"/>
</f:link.action>