diff --git a/README.md b/README.md index d4274f4..0c7421f 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,39 @@ DigiComp.SettingValidator ------------------------- - -This Package allows to configure Validators for your Action-Arguments or domain model properties to be set by a new +This Package allows configuring 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: +Let's imagine you had this action-method: /** + * @Flow\Validate(type="DigiComp.SettingValidator:Settings", argumentName="order") * @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 + Vendor\Package\Domain\Model\Order: + # validates the complete object + self: + 'Vendor.Package:SomeOtherValidator': [] + # validates properties of the object + properties: + price: + NumberRange: + maximum: 20 + minimum: 10 + customer: + 'DigiComp.SettingValidator:Settings': + name: 'OrderCustomer' OrderCustomer: - - - property: firstName - validator: StringLength - options: - minimum: 3 - maximum: 20 - + properties: + firstName: + StringLength: + minimum: 3 + maximum: 20 As you see: Nesting is possible ;) That way you can easily construct flexible structures.