Commit Graph

16858 Commits

Author SHA1 Message Date
Bernhard Schussek 50bb84d06b [Validator] Optimized RecursiveContextualValidator 2014-03-30 18:28:59 +02:00
Bernhard Schussek eed29d8ad3 [Validator] Improved performance of *ContextualValidator::validate() 2014-03-30 18:28:59 +02:00
Bernhard Schussek 5c479d803c [Validator] Simplified validateNodeForGroup 2014-03-30 18:28:59 +02:00
Bernhard Schussek eeed509dfc [Validator] Improved phpdoc of RecursiveValidator 2014-03-30 18:28:59 +02:00
Bernhard Schussek 274d4e6195 [Validator] Changed ValidatorBuilder to always use LegacyExecutionContext
This is necessary because, until Symfony 3.0, constraint validators will continue
to rely on the old context methods in order to be backwards compatible.
2014-03-30 18:28:59 +02:00
Bernhard Schussek 38e26fbcaf [Validator] Decoupled RecursiveContextualValidator from Node 2014-03-30 18:28:59 +02:00
Bernhard Schussek 23534ca6ab [Validator] Added a recursive clone of the new implementation for speed comparison 2014-03-30 18:28:59 +02:00
Bernhard Schussek f61d31e5fa [Validator] Fixed grammar 2014-03-30 18:28:58 +02:00
Bernhard Schussek 886e05e7ed [Validator] Removed unused use statement 2014-03-30 18:28:58 +02:00
Bernhard Schussek 93fdff764a [Validator] The supported API versions can now be passed to the ValidatorBuilder 2014-03-30 18:28:58 +02:00
Bernhard Schussek 987313d315 [Validator] Improved inline documentation of the violation builder 2014-03-30 18:28:58 +02:00
Bernhard Schussek 79387a7d5e [Validator] Improved inline documentation of the metadata classes 2014-03-30 18:28:58 +02:00
Bernhard Schussek 01ceeda376 [Validator] Improved test coverage of the Traverse constraint 2014-03-30 18:28:58 +02:00
Bernhard Schussek 9ca61df923 [Validator] Improved inline documentation of CascadingStrategy and TraversalStrategy 2014-03-30 18:28:58 +02:00
Bernhard Schussek 524a9538bc [Validator] Improved inline documentation of the validators 2014-03-30 18:28:58 +02:00
Bernhard Schussek 9986f03ce2 [Validator] Added inline documentation for the PropertyPath utility class 2014-03-30 18:28:58 +02:00
Bernhard Schussek be7f055237 [Validator] Visitors may now abort the traversal by returning false from beforeTraversal() 2014-03-30 18:28:58 +02:00
Bernhard Schussek 299c2dca10 [Validator] Improved test coverage and prevented duplicate validation of constraints 2014-03-30 18:28:58 +02:00
Bernhard Schussek 186c115894 [Validator] Improved test coverage of NonRecursiveNodeTraverser 2014-03-30 18:28:58 +02:00
Bernhard Schussek 822fe4712f [Validator] Completed inline documentation of the Node classes and the NodeTraverser 2014-03-30 18:28:58 +02:00
Bernhard Schussek dbce5a2f6a [Validator] Updated outdated doc blocks 2014-03-30 18:28:58 +02:00
Bernhard Schussek 8558377945 [Validator] Added deprecation notes 2014-03-30 18:28:57 +02:00
Bernhard Schussek e8fa15b27c [Validator] Fixed the new validator API under PHP < 5.3.9 2014-03-30 18:28:57 +02:00
Bernhard Schussek 2936d10aa4 [Validator] Removed unused use statement 2014-03-30 18:28:57 +02:00
Bernhard Schussek 6fc6ecdd8e [Validator] Fixed tests under PHP<5.3.9
The new implementation is disabled on those PHP versions.
2014-03-30 18:28:57 +02:00
Bernhard Schussek 778ec2458b [Validator] Removed helper class Traversal 2014-03-30 18:28:57 +02:00
Bernhard Schussek 76d8c9a1f7 [Validator] Fixed typos 2014-03-30 18:28:57 +02:00
Bernhard Schussek 416137165e [Validator] Removed unused use statements 2014-03-30 18:28:57 +02:00
Bernhard Schussek aeb68228b1 [Validator] Improved visitor names 2014-03-30 18:28:56 +02:00
Bernhard Schussek 08172bfe7b [Validator] Merged validate(), validateObject() and validateObjects() to simplify usage 2014-03-30 18:28:56 +02:00
Bernhard Schussek 51197f68a3 [Validator] Made traversal of Traversables consistent
If the traversal strategy is IMPLICIT (the default), the validator will now
traverse any object that implements \Traversable and any array
2014-03-30 18:28:56 +02:00
Bernhard Schussek 117b1b9a17 [Validator] Wrapped collections into CollectionNode instances 2014-03-30 18:28:56 +02:00
Bernhard Schussek 94583a9289 [Validator] Changed NodeTraverser to traverse nodes iteratively, not recursively
In this way, the deep method call chains are avoided. Also, it is possible to
avoid the many calls to leaveNode(), which are currently not really needed.
2014-03-30 18:28:56 +02:00
Bernhard Schussek cf1281feef [Validator] Added "Visitor" suffix to all node visitors 2014-03-30 18:28:56 +02:00
Bernhard Schussek 230f2a72fa [Validator] Fixed exception message 2014-03-30 18:28:56 +02:00
Bernhard Schussek e057b19964 [Validator] Decoupled ContextRefresher from ExecutionContext 2014-03-30 18:28:56 +02:00
Bernhard Schussek e440690bb4 [Validator] Renamed validateCollection() to validateObjects() 2014-03-30 18:28:56 +02:00
Bernhard Schussek df41974f31 [Validator] Changed context manager to context factory
The current context is not stored anymore. Instead, it is passed around the traverser
and the visitors. For this reason, validation can occur in multiple contexts at the
same time.
2014-03-30 18:28:56 +02:00
Bernhard Schussek 26eafa43f7 [Validator] Removed unused use statements 2014-03-30 18:28:56 +02:00
Bernhard Schussek bc29591935 [Validator] Clearly separated classes supporting the API <2.5/2.5+ 2014-03-30 18:28:55 +02:00
Bernhard Schussek a3555fbd99 [Validator] Fixed: Objects are not traversed unless they are instances of Traversable 2014-03-30 18:28:55 +02:00
Bernhard Schussek 2c65a28608 [Validator] Completed test coverage and documentation of the Node classes 2014-03-30 18:28:55 +02:00
Bernhard Schussek 9c9e715ca8 [Validator] Completed documentation of GroupManagerInterface 2014-03-30 18:28:55 +02:00
Bernhard Schussek 1e81f3bdc8 [Validator] Finished test coverage and documentation of ExecutionContextManager 2014-03-30 18:28:55 +02:00
Bernhard Schussek feb3d6f202 [Validator] Tested the validation in a separate context 2014-03-30 18:28:55 +02:00
Bernhard Schussek 718601c6c3 [Validator] Changed validateValue() to validate() in the new API
The validation of values against constraints should be a first-class citizen
in the API. For this reason, validate() now takes a value and a constraint or
a list of constraints. This method should be used for the most basic use
cases.

If users want to annotate objects with constraints (this is optional,
advanced functionality), they can use the more expressive validateObject()
method now. For traversing arrays or Traversables, a new method
validateCollection() is now available in the API.
2014-03-30 18:28:55 +02:00
Bernhard Schussek ee1adadbfb [Validator] Implemented handling of arrays and Traversables in LegacyExecutionContext::validate() 2014-03-30 18:28:55 +02:00
Bernhard Schussek 09f744b89c [Validator] Implemented BC traversal of traversables through validate() 2014-03-30 18:28:55 +02:00
Bernhard Schussek 297ba4f585 [Validator] Added a note why scalars are passed to cascadeObject() in NodeTraverser 2014-03-30 18:28:55 +02:00
Bernhard Schussek 9b07b0c672 [Validator] Implemented BC validation of arrays through validate() 2014-03-30 18:28:55 +02:00