41 lines
2.6 KiB
YAML
41 lines
2.6 KiB
YAML
|
name: GroupSequence
|
||
|
class_comment: null
|
||
|
dependencies: []
|
||
|
properties: []
|
||
|
methods:
|
||
|
- name: __construct
|
||
|
visibility: public
|
||
|
parameters:
|
||
|
- name: groups
|
||
|
comment: "# * A sequence of validation groups.\n# *\n# * When validating a group\
|
||
|
\ sequence, each group will only be validated if all\n# * of the previous groups\
|
||
|
\ in the sequence succeeded. For example:\n# *\n# * $validator->validate($address,\
|
||
|
\ null, new GroupSequence(['Basic', 'Strict']));\n# *\n# * In the first step,\
|
||
|
\ all constraints that belong to the group \"Basic\" will be\n# * validated. If\
|
||
|
\ none of the constraints fail, the validator will then validate\n# * the constraints\
|
||
|
\ in group \"Strict\". This is useful, for example, if \"Strict\"\n# * contains\
|
||
|
\ expensive checks that require a lot of CPU or slow, external\n# * services.\
|
||
|
\ You usually don't want to run expensive checks if any of the cheap\n# * checks\
|
||
|
\ fail.\n# *\n# * When adding metadata to a class, you can override the \"Default\"\
|
||
|
\ group of\n# * that class with a group sequence:\n# * #[GroupSequence(['Address',\
|
||
|
\ 'Strict'])]\n# * class Address\n# * {\n# * // ...\n# * }\n\
|
||
|
# *\n# * Whenever you validate that object in the \"Default\" group, the group\
|
||
|
\ sequence\n# * will be validated:\n# *\n# * $validator->validate($address);\n\
|
||
|
# *\n# * If you want to execute the constraints of the \"Default\" group for a\
|
||
|
\ class\n# * with an overridden default group, pass the class name as group name\
|
||
|
\ instead:\n# *\n# * $validator->validate($address, null, \"Address\")\n#\
|
||
|
\ *\n# * @author Bernhard Schussek <bschussek@gmail.com>\n# */\n# #[\\Attribute(\\\
|
||
|
Attribute::TARGET_CLASS)]\n# class GroupSequence\n# {\n# /**\n# * The groups in\
|
||
|
\ the sequence.\n# *\n# * @var array<int, string|string[]|GroupSequence>\n# */\n\
|
||
|
# public array $groups;\n# \n# /**\n# * The group in which cascaded objects are\
|
||
|
\ validated when validating\n# * this sequence.\n# *\n# * By default, cascaded\
|
||
|
\ objects are validated in each of the groups of\n# * the sequence.\n# *\n# *\
|
||
|
\ If a class has a group sequence attached, that sequence replaces the\n# * \"\
|
||
|
Default\" group. When validating that class in the \"Default\" group, the\n# *\
|
||
|
\ group sequence is used instead, but still the \"Default\" group should be\n\
|
||
|
# * cascaded to other objects.\n# */\n# public string|GroupSequence $cascadedGroup;\n\
|
||
|
# \n# /**\n# * Creates a new group sequence.\n# *\n# * @param array<string|string[]|GroupSequence>\
|
||
|
\ $groups The groups in the sequence"
|
||
|
traits: []
|
||
|
interfaces: []
|