update README.md
This commit is contained in:
parent
000c301d25
commit
a81c1bfe35
1 changed files with 21 additions and 26 deletions
39
README.md
39
README.md
|
@ -1,45 +1,40 @@
|
||||||
DigiComp.SettingValidator
|
DigiComp.SettingValidator
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
This Package allows configuring Validators for your Action-Arguments or domain model properties to be set by a new
|
||||||
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.
|
Yaml-File in your Configuration directory.
|
||||||
|
|
||||||
Lets imagine you had this action-method:
|
Let's imagine you had this action-method:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @Flow\Validate(type="DigiComp.SettingValidator:Settings", argumentName="order")
|
||||||
* @param Order $order
|
* @param Order $order
|
||||||
* @Flow\Validate(type="DigiComp.SettingValidator:Settings")
|
|
||||||
*/
|
*/
|
||||||
public function createOrder($order) {...}
|
public function createOrder($order) {...}
|
||||||
|
|
||||||
Then your Validation.yaml could look like this:
|
Then your Validation.yaml could look like this:
|
||||||
|
|
||||||
SuperVendor\SuperPackage\Domain\Model\Order:
|
Vendor\Package\Domain\Model\Order:
|
||||||
-
|
# validates the complete object
|
||||||
property: price
|
self:
|
||||||
validator: NumberRange
|
'Vendor.Package:SomeOtherValidator': []
|
||||||
options:
|
# validates properties of the object
|
||||||
|
properties:
|
||||||
|
price:
|
||||||
|
NumberRange:
|
||||||
maximum: 20
|
maximum: 20
|
||||||
minimum: 10
|
minimum: 10
|
||||||
-
|
customer:
|
||||||
validator: SuperVendor.SuperPackage:SomeOtherValidator #validates the complete object
|
'DigiComp.SettingValidator:Settings':
|
||||||
options: []
|
name: 'OrderCustomer'
|
||||||
-
|
|
||||||
property: customer
|
|
||||||
validator: DigiComp.SettingValidator:Settings
|
|
||||||
options:
|
|
||||||
name: OrderCustomer
|
|
||||||
|
|
||||||
OrderCustomer:
|
OrderCustomer:
|
||||||
-
|
properties:
|
||||||
property: firstName
|
firstName:
|
||||||
validator: StringLength
|
StringLength:
|
||||||
options:
|
|
||||||
minimum: 3
|
minimum: 3
|
||||||
maximum: 20
|
maximum: 20
|
||||||
|
|
||||||
|
|
||||||
As you see: Nesting is possible ;) That way you can easily construct flexible structures.
|
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
|
The SettingsValidator has an optional option: "name" - If you don't give one, it assumes your validation value is an
|
||||||
|
|
Loading…
Reference in a new issue