No description
Find a file
Ferdinand Kuhl 86cf0c546b
Some checks failed
ci/woodpecker/push/code-style Pipeline failed
adding code-style pipeline
2022-04-28 22:49:56 +02:00
.woodpecker adding code-style pipeline 2022-04-28 22:49:56 +02:00
Classes PSR-12 2020-03-10 14:35:24 +01:00
Configuration/Testing add quotes around strings in YAML files 2018-04-03 17:53:57 +02:00
Migrations/Code FIX: Do not migrate already migrated validators 2019-01-28 11:37:18 +01:00
Resources/Private/Schema TASK: Completely changing the layout of Validation.yaml 2017-06-02 23:14:05 +02:00
Tests/Functional PSR-12 for tests 2020-03-10 14:48:57 +01:00
.gitignore Initial commit 2014-04-18 14:20:28 +02:00
composer.json TASK: Apply migration Neos.Flow-20180415105700 2019-08-27 11:30:13 +02:00
License.txt Adding License and small readme 2015-04-29 17:50:13 +02:00
README.md optimized spaces in readme 2019-06-07 09:02:40 +02:00

DigiComp.SettingValidator

This Package allows to configure Validators for your Action-Arguments or domain model properties to be set by a new Yaml-File in your Configuration directory.

Lets imagine you had this action-method:

/**
 * @param Order $order
 * @Flow\Validate(type="DigiComp.SettingValidator:Settings")
 */
public function createOrder($order) {...}

Then your Validation.yaml could look like this:

SuperVendor\SuperPackage\Domain\Model\Order:
  -
	property: price 
	validator: NumberRange
	options:
	  maximum: 20
	  minimum: 10
  -
    validator: SuperVendor.SuperPackage:SomeOtherValidator #validates the complete object
    options: []
  -
    property: customer
    validator: DigiComp.SettingValidator:Settings
    options:
      name: OrderCustomer
      
OrderCustomer:
  -
    property: firstName
    validator: StringLength
    options:
      minimum: 3
      maximum: 20

As you see: Nesting is possible ;) That way you can easily construct flexible structures.

The SettingsValidator has an optional option: "name" - If you don't give one, it assumes your validation value is an object and searches in Validation.yaml for the FQCN.