Commit fe2f2b4c authored by Tino Goratsch's avatar Tino Goratsch

one more API breaking change: Do not use the old "Misc" validation rules in...

one more API breaking change: Do not use the old "Misc" validation rules in the module validators anymore
parent 06bb8575
......@@ -13,10 +13,6 @@ class AbstractValidator
* @var \ACP3\Core\Lang
*/
protected $lang;
/**
* @var \ACP3\Core\Validator\Rules\Misc
*/
protected $validate;
/**
* @var array
*/
......@@ -27,16 +23,15 @@ class AbstractValidator
protected $validator;
/**
* @param \ACP3\Core\Lang $lang
* @param \ACP3\Core\Validator\Validator $validator
* @param \ACP3\Core\Validator\Rules\Misc $validate
* @param \ACP3\Core\Lang $lang
* @param \ACP3\Core\Validator\Validator $validator
*/
public function __construct(
Core\Lang $lang, Core\Validator\Validator $validator, Rules\Misc $validate
Core\Lang $lang,
Core\Validator\Validator $validator
)
{
$this->lang = $lang;
$this->validate = $validate;
$this->validator = $validator;
}
......@@ -47,9 +42,7 @@ class AbstractValidator
*/
public function validateFormKey()
{
if ($this->validate->formToken() === false) {
throw new Core\Exceptions\InvalidFormToken();
}
$this->validator->addConstraint(Core\Validator\ValidationRules\FormTokenValidationRule::NAME);
}
/**
......@@ -59,6 +52,8 @@ class AbstractValidator
*/
protected function _checkForFailedValidation()
{
$this->validator->validate();
if (!empty($this->errors)) {
throw new Core\Exceptions\ValidationFailed($this->errors);
}
......
......@@ -98,7 +98,7 @@ services:
core.validator.abstract:
abstract: true
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc']
arguments: ['@core.lang', @core.validator]
core.validator.rules.acl:
class: ACP3\Core\Validator\Rules\ACL
......
......@@ -49,7 +49,7 @@ services:
articles.validator:
class: %articles.validator.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc', '@core.acl']
arguments: ['@core.lang', @core.validator, '@core.acl']
articles.validator.validation_rules.article_exists_validation_rule:
class: %articles.validator.validation_rules.article_exists_validation_rule.fqdn%
......
......@@ -17,16 +17,14 @@ class Validator extends Core\Validator\AbstractValidator
*
* @param \ACP3\Core\Lang $lang
* @param \ACP3\Core\Validator\Validator $validator
* @param \ACP3\Core\Validator\Rules\Misc $validate
* @param \ACP3\Core\ACL $acl
*/
public function __construct(
Core\Lang $lang,
Core\Validator\Validator $validator,
Core\Validator\Rules\Misc $validate,
Core\ACL $acl)
{
parent::__construct($lang, $validator, $validate);
parent::__construct($lang, $validator);
$this->acl = $acl;
}
......
......@@ -32,7 +32,7 @@ services:
categories.validator:
class: %categories.validator.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc', '@categories.model']
arguments: ['@core.lang', @core.validator, '@categories.model']
categories.validator.validation_rules.category_exists_validation_rule:
class: %categories.validator.validation_rules.category_exists_validation_rule.fqdn%
......
......@@ -21,17 +21,15 @@ class Validator extends Core\Validator\AbstractValidator
*
* @param \ACP3\Core\Lang $lang
* @param \ACP3\Core\Validator\Validator $validator
* @param \ACP3\Core\Validator\Rules\Misc $validate
* @param \ACP3\Modules\ACP3\Categories\Model\CategoryRepository $categoryRepository
*/
public function __construct(
Core\Lang $lang,
Core\Validator\Validator $validator,
Core\Validator\Rules\Misc $validate,
CategoryRepository $categoryRepository
)
{
parent::__construct($lang, $validator, $validate);
parent::__construct($lang, $validator);
$this->categoryRepository = $categoryRepository;
}
......
......@@ -38,7 +38,7 @@ services:
comments.validator:
class: %comments.validator.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc', '@core.modules']
arguments: ['@core.lang', @core.validator, '@core.modules']
comments.validator.validation_rules.flood_barrier_validation_rule:
class: %comments.validator.validation_rules.flood_barrier_validation_rule.fqdn%
......
......@@ -21,17 +21,15 @@ class Validator extends Core\Validator\AbstractValidator
*
* @param \ACP3\Core\Lang $lang
* @param \ACP3\Core\Validator\Validator $validator
* @param \ACP3\Core\Validator\Rules\Misc $validate
* @param \ACP3\Core\Modules $modules
*/
public function __construct(
Core\Lang $lang,
Core\Validator\Validator $validator,
Core\Validator\Rules\Misc $validate,
Core\Modules $modules
)
{
parent::__construct($lang, $validator, $validate);
parent::__construct($lang, $validator);
$this->modules = $modules;
}
......
......@@ -23,7 +23,7 @@ services:
contact.validator:
class: %contact.validator.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc']
parent: core.validator.abstract
contact.installer.schema:
class: %contact.installer.schema.fqdn%
......
......@@ -31,7 +31,7 @@ services:
emoticons.validator:
class: %emoticons.validator.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc']
parent: core.validator.abstract
emoticons.installer.schema:
class: %emoticons.installer.schema.fqdn%
......
......@@ -41,7 +41,7 @@ services:
files.validator:
class: %files.validator.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc', '@core.modules']
arguments: ['@core.lang', @core.validator, '@core.modules']
files.validator.validation_rules.is_external_file_validation_rule:
class: %files.validator.validation_rules.is_external_file_validation_rule.fqdn%
......
......@@ -22,17 +22,15 @@ class Validator extends Core\Validator\AbstractValidator
*
* @param \ACP3\Core\Lang $lang
* @param \ACP3\Core\Validator\Validator $validator
* @param \ACP3\Core\Validator\Rules\Misc $validate
* @param \ACP3\Core\Modules $modules
*/
public function __construct(
Core\Lang $lang,
Core\Validator\Validator $validator,
Core\Validator\Rules\Misc $validate,
Core\Modules $modules
)
{
parent::__construct($lang, $validator, $validate);
parent::__construct($lang, $validator);
$this->modules = $modules;
}
......
......@@ -59,15 +59,15 @@ services:
gallery.validator.gallery:
class: %gallery.validator.gallery.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc']
parent: core.validator.abstract
gallery.validator.picture:
class: %gallery.validator.picture.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc']
parent: core.validator.abstract
gallery.validator.settings:
class: %gallery.validator.settings.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc', '@core.modules']
arguments: ['@core.lang', @core.validator, '@core.modules']
gallery.installer.schema:
class: %gallery.installer.schema.fqdn%
......
......@@ -17,17 +17,15 @@ class Settings extends Core\Validator\AbstractValidator
/**
* @param Core\Lang $lang
* @param \ACP3\Core\Validator\Validator $validator
* @param Core\Validator\Rules\Misc $validate
* @param Core\Modules $modules
*/
public function __construct(
Core\Lang $lang,
Core\Validator\Validator $validator,
Core\Validator\Rules\Misc $validate,
Core\Modules $modules
)
{
parent::__construct($lang, $validator, $validate);
parent::__construct($lang, $validator);
$this->modules = $modules;
}
......
......@@ -28,7 +28,7 @@ services:
guestbook.validator:
class: %guestbook.validator.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc', '@core.modules']
arguments: ['@core.lang', @core.validator, '@core.modules']
guestbook.validator.validation_rules.flood_barrier_validation_rule:
class: %guestbook.validator.validation_rules.flood_barrier_validation_rule.fqdn%
......
......@@ -22,16 +22,14 @@ class Validator extends Core\Validator\AbstractValidator
*
* @param \ACP3\Core\Lang $lang
* @param \ACP3\Core\Validator\Validator $validator
* @param \ACP3\Core\Validator\Rules\Misc $validate
* @param \ACP3\Core\Modules $modules
*/
public function __construct(
Core\Lang $lang,
Core\Validator\Validator $validator,
Core\Validator\Rules\Misc $validate,
Core\Modules $modules)
{
parent::__construct($lang, $validator, $validate);
parent::__construct($lang, $validator);
$this->modules = $modules;
}
......
......@@ -65,11 +65,11 @@ services:
menus.validator.menu:
class: %menus.validator.menu.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc']
parent: core.validator.abstract
menus.validator.menuitem:
class: %menus.validator.menuitem.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc']
parent: core.validator.abstract
menus.validator.validation_rules.allowed_menu_validation_rule:
class: %menus.validator.validation_rules.allowed_menu_validation_rule.fqdn%
......
......@@ -42,7 +42,7 @@ services:
news.validator:
class: %news.validator.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc', '@core.modules']
arguments: ['@core.lang', @core.validator, '@core.modules']
news.validator.validation_rules.external_link_validation_rule:
class: %news.validator.validation_rules.external_link_validation_rule.fqdn%
......
......@@ -22,17 +22,15 @@ class Validator extends Core\Validator\AbstractValidator
*
* @param \ACP3\Core\Lang $lang
* @param \ACP3\Core\Validator\Validator $validator
* @param \ACP3\Core\Validator\Rules\Misc $validate
* @param \ACP3\Core\Modules $modules
*/
public function __construct(
Core\Lang $lang,
Core\Validator\Validator $validator,
Core\Validator\Rules\Misc $validate,
Core\Modules $modules
)
{
parent::__construct($lang, $validator, $validate);
parent::__construct($lang, $validator);
$this->modules = $modules;
}
......
......@@ -77,7 +77,7 @@ services:
newsletter.validator:
class: %newsletter.validator.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc']
parent: core.validator.abstract
newsletter.validator.validation_rules.account_exists_validation_rule:
class: %newsletter.validator.validation_rules.account_exists_validation_rule.fqdn%
......
......@@ -56,11 +56,11 @@ services:
permissions.validator.role:
class: %permissions.validator.role.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc']
parent: core.validator.abstract
permissions.validator.resource:
class: %permissions.validator.resource.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc']
parent: core.validator.abstract
permissions.validator.validation_rules.privilege_exists_validation_rule:
class: %permissions.validator.validation_rules.privilege_exists_validation_rule.fqdn%
......
......@@ -22,7 +22,7 @@ services:
seo.validator:
class: %seo.validator.fqdn%
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc', '@core.validator.rules.router', '@core.validator.rules.router.aliases']
parent: core.validator.abstract
seo.validator.validation_rules.uri_alias_validation_rule:
class: %seo.validator.validation_rules.uri_alias_validation_rule.fqdn%
......
......@@ -10,38 +10,6 @@ use ACP3\Modules\ACP3\Seo\Validator\ValidationRules\UriAliasValidationRule;
*/
class Validator extends Core\Validator\AbstractValidator
{
/**
* @var Core\Validator\Rules\Router
*/
protected $routerValidator;
/**
* @var Core\Validator\Rules\Router\Aliases
*/
protected $aliasesValidator;
/**
* Validator constructor.
*
* @param \ACP3\Core\Lang $lang
* @param \ACP3\Core\Validator\Validator $validator
* @param \ACP3\Core\Validator\Rules\Misc $validate
* @param \ACP3\Core\Validator\Rules\Router $routerValidator
* @param \ACP3\Core\Validator\Rules\Router\Aliases $aliasesValidator
*/
public function __construct(
Core\Lang $lang,
Core\Validator\Validator $validator,
Core\Validator\Rules\Misc $validate,
Core\Validator\Rules\Router $routerValidator,
Core\Validator\Rules\Router\Aliases $aliasesValidator)
{
parent::__construct($lang, $validator, $validate);
$this->routerValidator = $routerValidator;
$this->aliasesValidator = $aliasesValidator;
}
/**
* @param array $formData
* @param string $uriAlias
......
......@@ -53,4 +53,4 @@ services:
core.validator.abstract:
abstract: true
arguments: ['@core.lang', @core.validator, '@core.validator.rules.misc']
\ No newline at end of file
arguments: ['@core.lang', @core.validator]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment