diff --git a/Documentation/source/conf.py b/Documentation/source/conf.py index 9fd0cdd..893e66d 100644 --- a/Documentation/source/conf.py +++ b/Documentation/source/conf.py @@ -334,6 +334,14 @@ texinfo_documents = [ # # texinfo_no_detailmenu = False +### Allow inline php highlighting +# load PhpLexer +from sphinx.highlighting import lexers +from pygments.lexers.web import PhpLexer +# enable highlighting for PHP code not between by default +lexers['php'] = PhpLexer(startinline=True) +lexers['php-annotations'] = PhpLexer(startinline=True) +### Allow inline php highlighting # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {'https://docs.python.org/': None} diff --git a/Documentation/source/usage.rst b/Documentation/source/usage.rst index c3955d4..120e32e 100644 --- a/Documentation/source/usage.rst +++ b/Documentation/source/usage.rst @@ -10,6 +10,8 @@ The package introduces a new configuration type ``Validation``. The configuratio ``allowSplitSource`` is set to true, so it's possible to split large files into smaller ones by calling them like :file:`Validation.Users.yaml`. +.. _types-of-configuration: + Types of configuration ====================== @@ -20,6 +22,11 @@ Given the following :file:`Validation.yaml`: .. literalinclude:: /examples/Validation.yaml +One class is configured by it's fully qualified class name +``SuperVendor\SuperPackage\Domain\Model\Order`` and a custom name is configured ``OrderCustomer``. + +.. _types-of-configuration-custom-name: + Custom Name ----------- @@ -33,5 +40,40 @@ If you prefer the name, you have to configure the validator to use the specific */ public function createOrder($order) {...} +.. _types-of-configuration-fqcn: + Fully qualified class namespace ------------------------------- + +If you provide the fully qualified class name, you don't have to provide the additional +argument, the following code will be enough: + +.. code-block:: php + + /** + * @param Order $order + * @Flow\Validate(type="DigiComp.SettingValidator:Settings") + */ + public function createOrder($order) {...} + +.. _structure-of-configuration: + +Structure of configuration +========================== + +Each configured validation consist of an array with validation settings. +Each entry needs at least the following options: + +``validator`` + The Validator to use, the same way you would use in usual way. + E.g. use short names for Framework validators like ``StringLength`` or full path for custom + validators like ``DigiComp.SettingValidator:Settings``. +``options`` + An array of options to provide for the validator. + The same as you would have done through the usual way. + If the validator doesn't take arguments, provide an empty array. + +Also there are some optional options: + +``property`` + Optional, used to configure validation for a property of the object the validation is applied to.