No description
Find a file
2020-05-14 14:43:09 +02:00
Classes optimize error message 2020-05-13 09:48:43 +02:00
Configuration/Testing add quotes around strings in YAML files 2018-04-03 17:53:57 +02:00
Migrations/Code reformat code 2020-05-04 22:26:58 +02:00
Resources/Private/Schema write strings in yaml files in quotes 2020-03-11 10:39:33 +01:00
Tests/Functional added missing @throws 2020-05-14 14:43:09 +02:00
composer.json reorder lines 2020-05-13 10:20:20 +02:00
License.txt Adding License and small readme 2015-04-29 17:50:13 +02:00
README.md update README.md 2020-05-04 23:27:47 +02:00

DigiComp.SettingValidator

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.

Let's imagine you had this action-method:

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

Then your Validation.yaml could look like this:

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:
  properties:
    firstName:
      StringLength:
        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.