FEATURE: Add rest of documentation
* Provide structure information * Provide examples of usage * Allow syntax for inline php
This commit is contained in:
parent
ed6ff64d34
commit
a53f0213da
2 changed files with 50 additions and 0 deletions
|
@ -334,6 +334,14 @@ texinfo_documents = [
|
||||||
#
|
#
|
||||||
# texinfo_no_detailmenu = False
|
# 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 <?php ... ?> 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.
|
# Example configuration for intersphinx: refer to the Python standard library.
|
||||||
intersphinx_mapping = {'https://docs.python.org/': None}
|
intersphinx_mapping = {'https://docs.python.org/': None}
|
||||||
|
|
|
@ -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
|
``allowSplitSource`` is set to true, so it's possible to split large files into smaller ones by
|
||||||
calling them like :file:`Validation.Users.yaml`.
|
calling them like :file:`Validation.Users.yaml`.
|
||||||
|
|
||||||
|
.. _types-of-configuration:
|
||||||
|
|
||||||
Types of configuration
|
Types of configuration
|
||||||
======================
|
======================
|
||||||
|
|
||||||
|
@ -20,6 +22,11 @@ Given the following :file:`Validation.yaml`:
|
||||||
|
|
||||||
.. literalinclude:: /examples/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
|
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) {...}
|
public function createOrder($order) {...}
|
||||||
|
|
||||||
|
.. _types-of-configuration-fqcn:
|
||||||
|
|
||||||
Fully qualified class namespace
|
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.
|
||||||
|
|
Loading…
Reference in a new issue