本文整理汇总了PHP中TYPO3\CMS\Extbase\Mvc\Controller\ActionController::initializeActionMethodValidators方法的典型用法代码示例。如果您正苦于以下问题:PHP ActionController::initializeActionMethodValidators方法的具体用法?PHP ActionController::initializeActionMethodValidators怎么用?PHP ActionController::initializeActionMethodValidators使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Extbase\Mvc\Controller\ActionController
的用法示例。
在下文中一共展示了ActionController::initializeActionMethodValidators方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeActionMethodValidators
/**
* Adds the needed validators to the Arguments:
*
* - Validators checking the data type from the @param annotation
* - Custom validators specified with validate annotations.
* - Model-based validators (validate annotations in the model)
* - Custom model validator classes
* - Validators from framework configuration
*
* @return void
*/
protected function initializeActionMethodValidators()
{
parent::initializeActionMethodValidators();
$frameworkConfiguration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
$actionArgumentValidation = !empty($frameworkConfiguration['mvc']['validation'][$this->request->getControllerName()][$this->request->getControllerActionName()]) ? $frameworkConfiguration['mvc']['validation'][$this->request->getControllerName()][$this->request->getControllerActionName()] : array();
// Dynamically add argument validators
foreach ($actionArgumentValidation as $argumentName => $validators) {
try {
$argumentValidator = $this->arguments->getArgument($argumentName)->getValidator();
} catch (NoSuchArgumentException $e) {
continue;
}
$validatorConjunction = $this->validatorResolver->createValidator('TYPO3.CMS.Extbase:Conjunction');
foreach ($validators as $validatorConfiguration) {
if (isset($validatorConfiguration['type'])) {
$validatorType = $validatorConfiguration['type'];
$validatorOptions = isset($validatorConfiguration['options']) ? $validatorConfiguration['options'] : array();
$validator = $this->validatorResolver->createValidator($validatorType, $validatorOptions);
$validatorConjunction->addValidator($validator);
}
}
if (count($validatorConjunction)) {
$argumentValidator->addValidator($validatorConjunction);
}
}
}
示例2: initializeActionMethodValidators
/**
* Initialize action method validators
*
* @return void
*/
protected function initializeActionMethodValidators()
{
if ($this->actionMethodName == 'addAction') {
parent::initializeActionMethodValidators();
$blog = $this->arguments['blog'];
$validator = $blog->getValidator();
$requestArguments = $this->request->getArguments();
$agb = $requestArguments['data']['acceptTermsAndConditions'];
$termsAndConditions = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Lobacher\\Simpleblog\\Validation\\Validator\\TermsAndConditionsValidator', array('value' => $agb));
$validator->addValidator($termsAndConditions);
} else {
parent::initializeActionMethodValidators();
}
}
示例3: initializeActionMethodValidators
/**
* This method is overriden to allow proper assignment of parameters to fake actions.
*
* Therefore we change the actionMethodName shortly if the called action is a "fake" action
*
* @return void
* @see initializeArguments()
*/
protected function initializeActionMethodValidators()
{
if (!is_null($this->useActionName)) {
$temp = $this->actionMethodName;
$this->actionMethodName = $this->useActionName;
}
parent::initializeActionMethodValidators();
if (!is_null($this->useActionName)) {
$this->actionMethodName = $temp;
}
}