Commit Graph

16896 Commits

Author SHA1 Message Date
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
Bernhard Schussek
405a03b365 [Validator] Updated deprecation notes in GroupSequence 2014-03-30 18:28:55 +02:00
Bernhard Schussek
499b2bb601 [Validator] Completed test coverage of ExecutionContext 2014-03-30 18:28:55 +02:00
Bernhard Schussek
adc1437fab [Validator] Fixed failing tests 2014-03-30 18:28:54 +02:00
Bernhard Schussek
4ea3ff6688 [Validator] Finished inline documentation of ExecutionContext[Interface] 2014-03-30 18:28:54 +02:00
Bernhard Schussek
f6b7288449 [Validator] Removed unused use statement 2014-03-30 18:28:54 +02:00
Bernhard Schussek
8318286650 [Validator] Completed GroupSequence implementation 2014-03-30 18:28:54 +02:00
Bernhard Schussek
5fbf848f2f [Validator] Added note about Callback constraint to CHANGELOG 2014-03-30 18:28:54 +02:00
Bernhard Schussek
c1b1e03399 [Validator] Added TODO reminder 2014-03-30 18:28:54 +02:00
Bernhard Schussek
8ae68c9543 [Validator] Made tests green (yay!) 2014-03-30 18:28:54 +02:00
Bernhard Schussek
680f1ee6c7 [Validator] Renamed $params to $parameters 2014-03-30 18:28:54 +02:00
Bernhard Schussek
321d5bb30a [Validator] Throw exception if ObjectInitializer is constructed without visitors 2014-03-30 18:28:54 +02:00
Bernhard Schussek
1156bde823 [Validator] Extracted code for group sequence resolving into GroupSequenceResolver 2014-03-30 18:28:54 +02:00
Bernhard Schussek
b1a947737a [Validator] Added ObjectInitializer visitor 2014-03-30 18:28:54 +02:00
Bernhard Schussek
7e3a41d9db [Validator] Moved visitors to NodeVisitor namespace 2014-03-30 18:28:54 +02:00
Bernhard Schussek
a40189ccb7 [Validator] Decoupled the new classes a bit 2014-03-30 18:28:54 +02:00
Bernhard Schussek
a6ed4cae5d [Validator] Prototype of the traverser implementation 2014-03-30 18:28:53 +02:00
Bernhard Schussek
25cdc68d36 [Validator] Refactored ValidatorTest and ValidationVisitorTest into an abstract validator test class 2014-03-30 18:28:53 +02:00
Bernhard Schussek
9aee2ad999 [PropertyAccess] Removed the argument $value from isWritable()
To keep isWritable() and setValue() consistent, the exception thrown when only
an adder was present, but no remover (or vice versa), was removed.
2014-03-30 18:19:56 +02:00
Fabien Potencier
95f8e43205 bug #10581 [Validator][Email] - When standalone "Fatal error: Class 'validator.email' not found" (egulias)
This PR was merged into the 2.5-dev branch.

Discussion
----------

[Validator][Email] - When standalone "Fatal error: Class 'validator.email' not found"

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/silexphp/Silex/issues/932
| License       | MIT
| Doc PR        | no

When using the validator as an standalone component a bug was introduced by overriding the `validatedBy()` method in the `Email` constraint.
This PR removes the override and implements a way for the DI to get the right validator.

Another way would be modifying the definition of validator to change the alias instead of having the FQCN in the xml

Commits
-------

e79b3a9 Change in validator.email service alias to match the validator FQCN
2014-03-30 09:34:45 +02:00
Eduardo Gulias Davis
e79b3a9755 Change in validator.email service alias to match the validator FQCN 2014-03-30 09:34:45 +02:00